Nothing
url <- "https://eu.httpbin.org/get?foo=123"
test_that("can mock top-level", {
mok <- function(...) "mocked request"
res <- with_mock(
`curl::curl_fetch_memory` = mok,
curl::curl_fetch_memory(url)
)
expect_identical(res, "mocked request")
})
test_that("can access calling env", {
asw <- "mocked request"
mok <- function(...) asw
res <- with_mock(
`curl::curl_fetch_memory` = mok,
curl::curl_fetch_memory(url)
)
expect_identical(res, asw)
})
test_that("can mock nested", {
mok <- function(...) "mocked request"
dlf <- function(x) curl::curl_fetch_memory(x)
res <- with_mock(
`curl::curl_fetch_memory` = mok,
dlf(url)
)
expect_identical(res, "mocked request")
})
test_that("visibility propagates", {
expect_invisible(
res <- with_mock(
`curl::curl_fetch_memory` = quote(invisible(NULL)),
curl::curl_fetch_memory(url)
)
)
expect_null(res)
})
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.