Skip to content

Commit

Permalink
minor test update
Browse files Browse the repository at this point in the history
  • Loading branch information
romainfrancois committed Nov 6, 2015
1 parent c85c5ff commit 4c0dbb8
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion tests/testthat/test-group-by.r
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ test_that("grouped_df requires a list of symbols (#665)", {
})

test_that("group_by gives meaningful message with unknow column (#716)",{
expect_error( group_by(iris, wrong_name_of_variable), "unknown column" )
expect_error( group_by(iris, wrong_name_of_variable), "unknown variable to group by" )
})

test_that("[ on grouped_df preserves grouping if subset includes grouping vars", {
Expand Down Expand Up @@ -256,3 +256,15 @@ test_that("ungroup.rowwise_df gives a tbl_df (#936)", {
res <- tbl_df(mtcars) %>% rowwise %>% ungroup %>% class
expect_equal( res, c("tbl_df", "data.frame"))
})

test_that( "group_by supports column (#1012)", {
g1 <- mtcars %>% group_by(cyl)
g2 <- mtcars %>% group_by(column(~cyl))
g3 <- mtcars %>% group_by(column("cyl"))
a <- "cyl"
g4 <- mtcars %>% group_by(column(a))

expect_equal( attr(g1, "vars"), attr(g2, "vars"))
expect_equal( attr(g1, "vars"), attr(g3, "vars"))
expect_equal( attr(g1, "vars"), attr(g4, "vars"))
})

0 comments on commit 4c0dbb8

Please sign in to comment.