Skip to content

Commit

Permalink
Merge pull request #41 from jennybc/master
Browse files Browse the repository at this point in the history
add test that [ does not change class
  • Loading branch information
hadley committed Mar 17, 2016
2 parents 88f86cd + b15609a commit 77f2d47
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/testthat/test-tbl-df.r
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ test_that("[ never drops", {
expect_equal(mtcars2[, 1], mtcars2[1])
})

test_that("[ retains class", {
mtcars2 <- tbl_df(mtcars)
expect_identical(class(mtcars2), class(mtcars2[1:5, ]))
expect_identical(class(mtcars2), class(mtcars2[, 1:5]))
expect_identical(class(mtcars2), class(mtcars2[1:5, 1:5]))
})

test_that("[ with 0 cols creates correct row names (#656)", {
zero_row <- tbl_df(iris)[, 0]
expect_is(zero_row, "tbl_df")
Expand Down

0 comments on commit 77f2d47

Please sign in to comment.