/usr/share/doc/r-cran-tibble/tests/testthat/test-has-name.R is in r-cran-tibble 1.4.1-1ubuntu1.
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 23 24 | context("has-name")
test_that("basic", {
expect_true(has_name(iris, "Species"))
expect_false(has_name(mtcars, "gears"))
})
test_that("other types", {
expect_true(has_name(list(a = 1), "a"))
expect_true(has_name(c(a = 1), "a"))
})
test_that("vectorized", {
expect_equal(has_name(list(a = 1), letters), c(TRUE, rep(FALSE, 25)))
})
test_that("NA", {
expect_false(has_name(list(a = 1), NA))
})
test_that("unnamed", {
expect_false(has_name(1, "a"))
expect_true(has_name(1, ""))
})
|