/usr/share/doc/r-cran-tibble/tests/testthat/test-repair_names.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 25 26 27 28 29 | context("repair_names")
test_that("zero-length inputs given character names", {
out <- repair_names(character())
expect_equal(names(out), character())
})
test_that("unnamed input gives uniquely named output", {
out <- repair_names(1:3)
expect_equal(names(out), c("V1", "V2", "V3"))
})
# make_unique -------------------------------------------------------------
test_that("duplicates are de-deduped", {
expect_equal(make_unique(c("x", "x")), c("x", "x1"))
})
test_that("blanks get prefix + numeric id", {
expect_equal(make_unique(c("", "")), c("V1", "V2"))
})
test_that("blanks skip existing names", {
expect_equal(make_unique(c("", "V1")), c("V2", "V1"))
})
test_that("blanks skip names created when de-duping", {
expect_equal(make_unique(c("", "V", "V")), c("V2", "V", "V1"))
})
|