testit::assert("Compares test and ref json for function supplied as function: pass", {
test_function <- function(x){ list(names(x)) }
out <- capture.output(json_test(func = test_function,
package = "json2test",
test_id = "test_cases",
list_as_args = TRUE,
fail_if_not_exists = FALSE),
type = "message")
any(grepl("\u2713", out))
})
testit::assert("Compares test and ref json for function supplied as function: fail", {
test_function <- function(x){ list(lapply(x, is.numeric)) }
out <- capture.output(json_test(func = test_function,
package = "json2test",
test_id = "test_cases",
list_as_args = TRUE,
fail_if_not_exists = FALSE),
type = "message")
!any(grepl("\u2713", out))
any(grepl("\\[ \\]", out))
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.