context("get_xml_opening_tag")
test_that("use '<tag text=hello</tag>'", {
xml <- "<parameter id=\"birthRate.t:anthus_aco_sub\" name=\"stateNode\">1.0</parameter>" # nolint XML can be long
created <- get_xml_opening_tag(xml)
expected <- "parameter"
testthat::expect_equal(created, expected)
})
test_that("use '<tag text=hello/>'", {
xml <- "<taxon id=\"630116_aco\" spec=\"Taxon\"/>" # nolint this is no absolute path
created <- get_xml_opening_tag(xml)
expected <- "taxon"
testthat::expect_equal(created, expected)
})
test_that("No tag gives NA", {
testthat::expect_true(
is_one_na(
get_xml_opening_tag("no xml")
)
)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.