test_that("locate_input() works", {
with_mocked_bindings(
reprex_clipboard = function() TRUE,
expect_identical("clipboard", locate_input(NULL))
)
with_mocked_bindings(
reprex_clipboard = function() FALSE,
in_rstudio = function() TRUE,
expect_identical("selection", locate_input(NULL))
)
with_mocked_bindings(
reprex_clipboard = function() FALSE,
in_rstudio = function() FALSE,
expect_null(locate_input(NULL))
)
expect_identical("path", locate_input(path_temp()))
expect_identical("input", locate_input(c("a", "b")))
expect_identical("input", locate_input("a\n"))
})
test_that("nope() defaults to 'yes' if user not available", {
expect_false(nope())
})
test_that("yep() defaults to 'no' if user not available", {
expect_false(yep())
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.