tests/testthat/test-options.R
raw| 1 | test_that("local_options lets you unset an option (#156)", { |
| 2 | expect_true(is.null(getOption("x"))) |
| 3 | local({ |
| 4 | local_options(foo = "bar") |
| 5 | expect_equal(getOption("foo"), "bar") |
| 6 | }) |
| 7 | |
| 8 | expect_true(is.null(getOption("x"))) |
| 9 | |
| 10 | local({ |
| 11 | local_options(foo = "bar") |
| 12 | expect_equal(getOption("foo"), "bar") |
| 13 | local_options(foo = NULL) |
| 14 | expect_true(is.null(getOption("x"))) |
| 15 | }) |
| 16 | expect_true(is.null(getOption("x"))) |
| 17 | }) |