From 658ad9adc6a7192d77e94d9ed75a0eeca37a70a1 Mon Sep 17 00:00:00 2001 From: Melkiades Date: Thu, 9 Feb 2023 12:36:14 +0100 Subject: [PATCH] capturing it --- tests/testthat/test-g_lineplot.R | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/testthat/test-g_lineplot.R b/tests/testthat/test-g_lineplot.R index c3cc03e7fc..90bb454760 100644 --- a/tests/testthat/test-g_lineplot.R +++ b/tests/testthat/test-g_lineplot.R @@ -4,11 +4,14 @@ adlb$AVISIT <- droplevels(adlb$AVISIT) adlb <- dplyr::mutate(adlb, AVISIT = forcats::fct_reorder(AVISIT, AVISITN, min)) testthat::test_that("g_lineplot works with default settings", { - g_lineplot(adlb, adsl) + some_warning <- capture_warnings(g_lineplot(adlb, adsl)) + if (isTRUE(length(some_warning) > 0)){ + stop("THIS IS THE WARNING 1: ", some_warning) + } }) testthat::test_that("g_lineplot works with custom settings and statistics table", { - g_lineplot( + some_warning <- capture_warnings(g_lineplot( adlb, adsl, strata = control_lineplot_vars(strata = NULL), @@ -19,5 +22,8 @@ testthat::test_that("g_lineplot works with custom settings and statistics table" y_lab = "Lab Test", subtitle = "Laboratory Test:", caption = "caption" - ) + )) + if (isTRUE(length(some_warning) > 0)){ + stop("THIS IS THE WARNING 2: ", some_warning) + } })