test_that("xml_structure", { expect_output( xml_structure(read_xml("")), " " ) expect_output( xml_structure(read_xml(""), indent = 0L), " " ) }) test_that("xml_structure can write to a file (#244)", { tmp <- tempfile() xml_structure(read_xml(""), file = tmp) expect_equal(readLines(tmp), c("", " ", " ", " ", " ")) # repeated calls erase existing content xml_structure(read_xml(""), file = tmp) expect_equal(readLines(tmp), c("", " ", " ", " ", " ")) }) test_that("xml_structure is correct", { x <- read_html(test_path("lego.html.bz2")) quicklinks <- xml_find_first(x, "//div[contains(@div, 'quicklinks')]") expect_snapshot(html_structure(quicklinks)) })