Skip to content

Commit

Permalink
test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Dec 18, 2023
1 parent 9bc14f3 commit d0332db
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/testthat/test-labels_to_levels.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,18 @@ test_that("labels_to_levels, factor, error on no labels", {
expect_error(labels_to_levels(iris), regex = "Could not change factor")
})

test_that("labels_to_levels, data frame, append", {
data(efc)
out <- labels_to_levels(efc, append = "_ll")
expect_named(out, c("c12hour", "e16sex", "e42dep", "c172code", "neg_c_7", "e42dep_ll"))
})

test_that("labels_to_levels, data frame, append", {
data(iris)
d <- as.data.frame(lapply(iris, as.factor))
expect_identical(labels_to_levels(d), d)
})

test_that("labels_to_levels, factor, data frame", {
data(efc)
out <- labels_to_levels(efc)
Expand Down

0 comments on commit d0332db

Please sign in to comment.