/usr/share/doc/r-cran-rlang/tests/testthat/test-utils.R is in r-cran-rlang 0.2.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | context("utils")
test_that("locale setters report old locale", {
tryCatch(
old <- suppressMessages(mut_mbcs_locale()),
warning = function(e) skip("Cannot set MBCS locale")
)
mbcs <- suppressMessages(mut_latin1_locale())
suppressMessages(Sys.setlocale("LC_CTYPE", old))
expect_true(tolower(mbcs) %in% tolower(c("ja_JP.SJIS", "English_United States.932")))
})
old_digits <- getOption("digits")
test_that("scoped_options() sets options", {
old <- scoped_options(digits = 2L)
expect_identical(old$digits, old_digits)
expect_identical(getOption("digits"), 2L)
})
test_that("scoped_options() restores options", {
expect_identical(getOption("digits"), old_digits)
})
|