Skip to content

Commit

Permalink
added test for set_names
Browse files Browse the repository at this point in the history
  • Loading branch information
trinker committed Dec 28, 2014
1 parent cd267b3 commit 56a1e4f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/testthat/test-names.R
Expand Up @@ -14,3 +14,19 @@ test_that("names are changed by assigment",{

expect_equivalent(names(minimal), x)
})


test_that("names are changed by setting (similar to `setNames`)",{

minimal <- structure("abc", class = c("regexr", "character"), regex = list(
"a", "b", "c"), comments = list(NULL, NULL, NULL))

out <- set_names(minimal, 1:3)

out_check <- structure("abc", class = c("regexr", "character"), regex = structure(list(
`1` = "a", `2` = "b", `3` = "c"), .Names = c("1", "2", "3"
)), comments = structure(list(`1` = NULL, `2` = NULL, `3` = NULL), .Names = c("1",
"2", "3")))

expect_equivalent(out, out_check)
})

0 comments on commit 56a1e4f

Please sign in to comment.