diff --git a/README.md b/README.md index aaba5a1..be4ef2d 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -[![R-CMD-check](https://github.com/imbi-heidelberg/DescrTab2/workflows/R-CMD-check/badge.svg)](https://github.com/imbi-heidelberg/DescrTab2/actions) +[![R-CMD-check](https://github.com/imbi-heidelberg/DescrTab2/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/imbi-heidelberg/DescrTab2/actions/workflows/R-CMD-check.yaml) [![codecov](https://codecov.io/gh/imbi-heidelberg/DescrTab2/branch/master/graph/badge.svg)](https://app.codecov.io/gh/imbi-heidelberg/DescrTab2) [![Github version](https://img.shields.io/github/r-package/v/imbi-heidelberg/DescrTab2/master?label=Github%20version%20%40master)](https://github.com/imbi-heidelberg/DescrTab2/tree/master) [![CRAN Version](https://www.r-pkg.org/badges/version/DescrTab2)](https://www.r-pkg.org/badges/version/DescrTab2) diff --git a/tests/testthat/test_html.R b/tests/testthat/test_html.R index 33bc61e..55500f6 100644 --- a/tests/testthat/test_html.R +++ b/tests/testthat/test_html.R @@ -1,4 +1,7 @@ -# write_in_tmpfile_for_cran() <- FALSE +library(dplyr, quietly=TRUE, warn.conflicts=FALSE) +dat <- iris[, c("Species", "Sepal.Length")] +dat <- dat |> mutate(animal = c("Mammal", "Fish") |> rep(75) %>% factor()) +dat <- dat |> mutate(food = c("fries", "wedges") |> sample(150, TRUE) |> factor()) test_that( "knit an html file with DescrTab2 tables", { @@ -21,4 +24,12 @@ test_that("Outputformat html produces no errors",{ group_labels = list(setosa = "My custom group label"), var_options = list(Sepal.Length = list(label = "My custom variable label")) ) %>% print(print_format="html", silent=FALSE)), NA) + + expect_error(capture_output(descr( + dat, + "animal", + group_labels = list(setosa = "My custom group label"), + format_options = list(print_CI=TRUE), + var_options = list(Sepal.Length = list(label = "My custom variable label")) + ) |> print(print_format="html", silent=FALSE)), NA) }) diff --git a/tests/testthat/test_tex.R b/tests/testthat/test_tex.R index 11515cc..050c73e 100644 --- a/tests/testthat/test_tex.R +++ b/tests/testthat/test_tex.R @@ -1,3 +1,8 @@ +library(dplyr, quietly=TRUE, warn.conflicts=FALSE) +dat <- iris[, c("Species", "Sepal.Length")] +dat <- dat |> mutate(animal = c("Mammal", "Fish") |> rep(75) %>% factor()) +dat <- dat |> mutate(food = c("fries", "wedges") |> sample(150, TRUE) |> factor()) + test_that("knit a tex file with DescrTab2 tables", { skip_on_cran() # skip_on_ci() @@ -18,5 +23,12 @@ test_that("Outputformat .tex produces no errors",{ "Species", group_labels = list(setosa = "My custom group label"), var_options = list(Sepal.Length = list(label = "My custom variable label")) - ) %>% print(print_format="tex", silent=FALSE)), NA) + ) |> print(print_format="tex", silent=FALSE)), NA) + expect_error(capture_output(descr( + dat, + "animal", + group_labels = list(setosa = "My custom group label"), + format_options = list(print_CI=TRUE), + var_options = list(Sepal.Length = list(label = "My custom variable label")) + ) |> print(print_format="tex", silent=FALSE)), NA) })