Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add tests for rename() with lists

  • Loading branch information...
commit 0e9bae548e5a9bd98d92baaf133d66761887acec 1 parent bea57ac
@wch wch authored
Showing with 12 additions and 0 deletions.
  1. +12 −0 inst/tests/test-rename.r
View
12 inst/tests/test-rename.r
@@ -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))
+})
Please sign in to comment.
Something went wrong with that request. Please try again.