Skip to content

Commit

Permalink
Refactor test
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley committed Oct 30, 2023
1 parent 0aef67f commit d429239
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions tests/testthat/test-xml_parse.R
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,10 @@ test_that("read_xml and read_html fail with > 1 input", {
})

test_that("read_xml with an invalid file allows deletion of the file (#376)", {
tmp <- tempfile(fileext = ".xml")
on.exit(unlink(tmp))
writeLines("<a>", con = tmp)
tmp <- withr::local_tempfile(lines = "<a>")

expect_error(
read_xml(tmp)
)
n_cons <- nrow(showConnections())
try(read_xml(tmp), silent = TRUE)
expect_equal(nrow(showConnections()), n_cons)
expect_true(file.remove(tmp))
})

0 comments on commit d429239

Please sign in to comment.