## https://github.com/gadenbuie/js4shiny/blob/main/tests/testthat/test-utils.R
test_that("requires_pkg", {
missing_pkg <- function() requires_pkg("flarf")
has_pkg <- function() requires_pkg("ggplot2")
missing_pkg_v <- function() requires_pkg_version("flarf", "1.2")
outdated_pkg <- function() requires_pkg_version("ggplot2", "1.0.0")
uptodate_pkg <- function() requires_pkg_version("ggplot2", "1.6.0")
expect_silent(has_pkg())
expect_silent(uptodate_pkg())
expect_error(missing_pkg(), "missing_pkg.+requires.+flarf")
expect_error(missing_pkg_v(), "missing_pkg_v.+requires.+flarf")
expect_null(outdated_pkg())
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.