tests/testthat/test-from_just.R

test_that("from_just will fail with non-maybe values", {
  for_all(
    a = anything(),
    property = function(a) from_just(a) %>% expect_error()
  )
})

test_that("from_just will fail with nothing", {
   nothing() %>% from_just() %>% expect_error()
})

test_that("from_just unwraps a just value", {
  for_all(
    a = anything(),
    property = function(a)
      just(a) %>%
        from_just() %>%
        expect_identical(a)
  )
})

Try the maybe package in your browser

Any scripts or data that you put into this service are public.

maybe documentation built on Aug. 7, 2023, 5:11 p.m.