From d0332dbae5c57f5867a2965d97c58a272990fe27 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 18 Dec 2023 20:48:58 +0100 Subject: [PATCH] test coverage --- tests/testthat/test-labels_to_levels.R | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/testthat/test-labels_to_levels.R b/tests/testthat/test-labels_to_levels.R index 866154c8f..87a0418b9 100644 --- a/tests/testthat/test-labels_to_levels.R +++ b/tests/testthat/test-labels_to_levels.R @@ -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)