Permalink
Browse files

Add tests for rename() with lists

  • Loading branch information...
wch committed Oct 9, 2012
1 parent bea57ac commit 0e9bae548e5a9bd98d92baaf133d66761887acec
Showing with 12 additions and 0 deletions.
  1. +12 −0 inst/tests/test-rename.r
View
@@ -26,3 +26,15 @@ test_that("Multiple names correctly changed", {
expect_equal(names(y), c("d", "e", "f"))
})
+
+test_that("Empty vectors and lists", {
+ rename(character(), c("c" = "f", "b" = "e", "a" = "d"))
+
+ expect_equal(names(y), c("d", "e", "f"))
+})
+
+test_that("Renaming lists", {
+ x <- list(a = 1, b = 2, c = 3)
+ y <- rename(x, c("c" = "f", "b" = "e", "a" = "d"))
+ expect_identical(y, list(d = 1, e = 2, f = 3))
+})

0 comments on commit 0e9bae5

Please sign in to comment.