Nothing
test_that("promise_map handles NULL values", {
prom2_map <- function(first_res, second_res) {
f <- function(index) {
switch(index, first_res, second_res)
}
promise_map(1:2, f)
}
counter <- 0
prom2_map("anything", "anything_else") |>
then(\(x) {
counter <<- counter + 1
expect_equal(x, list("anything", "anything_else"))
}) |>
wait_for_it()
prom2_map(NULL, "anything_else") |>
then(\(x) {
counter <<- counter + 1
expect_equal(x, list(NULL, "anything_else"))
}) |>
wait_for_it()
prom2_map("anything", NULL) |>
then(\(x) {
counter <<- counter + 1
expect_equal(x, list("anything", NULL))
}) |>
wait_for_it()
prom2_map(NULL, NULL) |>
then(\(x) {
counter <<- counter + 1
expect_equal(x, list(NULL, NULL))
}) |>
wait_for_it()
expect_equal(counter, 4)
})
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.