diff --git a/tests/testthat/test-Archiver.R b/tests/testthat/test-Archiver.R index 5bcaebc5..013ba53e 100644 --- a/tests/testthat/test-Archiver.R +++ b/tests/testthat/test-Archiver.R @@ -20,7 +20,7 @@ reporter <- Reporter$new() reporter$append_cards(list(card1, card2)) testthat::test_that("intialize Archiver", { - expect_error(Archiver$new(), NA) + testthat::expect_no_error(Archiver$new()) }) testthat::test_that("new returns an object of type Archiver", { @@ -34,7 +34,7 @@ testthat::test_that("Archiver errors with the abstract methods", { }) testthat::test_that("intialize FileArchiver", { - testthat::expect_error(FileArchiver$new(), NA) + testthat::expect_no_error(FileArchiver$new()) }) testthat::test_that("FileArchiver creates a temp directory when initialized", { @@ -58,7 +58,7 @@ testthat::test_that("FileArchiver dectructor removes the temp dir", { }) testthat::test_that("intialize JSONArchiver", { - testthat::expect_error(JSONArchiver$new(), NA) + testthat::expect_no_error(JSONArchiver$new()) }) testthat::test_that("JSONArchiver creates a temp directory when initialized", { @@ -79,7 +79,7 @@ testthat::test_that("JSONArchiver dectructor removes the temp dir", { archiver <- JSONArchiver$new() testthat::test_that("JSONArchiver write a reporter", { - testthat::expect_error(archiver$write(reporter), NA) + testthat::expect_no_error(archiver$write(reporter)) }) path_with_files <- archiver$get_output_dir() diff --git a/tests/testthat/test-ContentBlock.R b/tests/testthat/test-ContentBlock.R index ec74489a..141687e7 100644 --- a/tests/testthat/test-ContentBlock.R +++ b/tests/testthat/test-ContentBlock.R @@ -1,5 +1,5 @@ testthat::test_that("ContentBlock object can be created", { - testthat::expect_error(ContentBlock$new(), regexp = NA) + testthat::expect_no_error(ContentBlock$new()) }) testthat::test_that("new returns an object of type ContentBlock", { @@ -8,7 +8,7 @@ testthat::test_that("new returns an object of type ContentBlock", { testthat::test_that("set_content accepts a character object", { block <- ContentBlock$new() - testthat::expect_error(block$set_content("test"), regexp = NA) + testthat::expect_no_error(block$set_content("test")) }) testthat::test_that("set_content asserts the argument is character", { diff --git a/tests/testthat/test-DownloadReportModule.R b/tests/testthat/test-DownloadReportModule.R index ae90fff7..89a274ee 100644 --- a/tests/testthat/test-DownloadReportModule.R +++ b/tests/testthat/test-DownloadReportModule.R @@ -111,7 +111,7 @@ knitr_args <- list() temp_dir <- tempdir() testthat::test_that("report_render_and_compress - valid arguments", { - testthat::expect_error(report_render_and_compress(reporter, input, knitr_args, temp_dir), NA) + testthat::expect_no_error(report_render_and_compress(reporter, input, knitr_args, temp_dir)) }) testthat::test_that("report_render_and_compress - invalid arguments", { diff --git a/tests/testthat/test-FileBlock.R b/tests/testthat/test-FileBlock.R index 29296fb6..24b07b65 100644 --- a/tests/testthat/test-FileBlock.R +++ b/tests/testthat/test-FileBlock.R @@ -1,5 +1,5 @@ testthat::test_that("FileBlock object can be created", { - testthat::expect_error(FileBlock$new(), regexp = NA) + testthat::expect_no_error(FileBlock$new()) }) testthat::test_that("new returns an object of type FileBlock", { diff --git a/tests/testthat/test-NewpageBlock.R b/tests/testthat/test-NewpageBlock.R index 80c2bc29..b739ff8f 100644 --- a/tests/testthat/test-NewpageBlock.R +++ b/tests/testthat/test-NewpageBlock.R @@ -1,5 +1,5 @@ testthat::test_that("NewpageBlock object can be created", { - testthat::expect_error(NewpageBlock$new(), regexp = NA) + testthat::expect_no_error(NewpageBlock$new()) }) testthat::test_that("new returns an object of type NewpageBlock", { @@ -8,5 +8,5 @@ testthat::test_that("new returns an object of type NewpageBlock", { testthat::test_that("set_content accepts a string", { block <- NewpageBlock$new() - testthat::expect_error(block$get_content(), regexp = NA) + testthat::expect_no_error(block$get_content()) }) diff --git a/tests/testthat/test-RcodeBlock.R b/tests/testthat/test-RcodeBlock.R index e4a06152..6066d237 100644 --- a/tests/testthat/test-RcodeBlock.R +++ b/tests/testthat/test-RcodeBlock.R @@ -1,5 +1,5 @@ testthat::test_that("RcodeBlock object can be created", { - testthat::expect_error(RcodeBlock$new(), regexp = NA) + testthat::expect_no_error(RcodeBlock$new()) }) testthat::test_that("new returns an object of type RcodeBlock", { @@ -8,7 +8,7 @@ testthat::test_that("new returns an object of type RcodeBlock", { testthat::test_that("set_content accepts a string", { block <- RcodeBlock$new() - testthat::expect_error(block$set_content("test"), regexp = NA) + testthat::expect_no_error(block$set_content("test")) }) testthat::test_that("set_content asserts the argument is a string", { @@ -37,7 +37,7 @@ testthat::test_that("set_params accepts one of the styles returned by get_availa for (param in RcodeBlock$new()$get_available_params()) { input <- list() input[[param]] <- NULL - testthat::expect_error(RcodeBlock$new()$set_params(input), regexp = NA) + testthat::expect_no_error(RcodeBlock$new()$set_params(input)) } }) diff --git a/tests/testthat/test-Renderer.R b/tests/testthat/test-Renderer.R index e5e12aed..139caa06 100644 --- a/tests/testthat/test-Renderer.R +++ b/tests/testthat/test-Renderer.R @@ -1,5 +1,5 @@ testthat::test_that("Renderer object can be created", { - testthat::expect_error(Renderer$new(), regexp = NA) + testthat::expect_no_error(Renderer$new()) }) testthat::test_that("new returns an object of type Renderer", { diff --git a/tests/testthat/test-ReportCard.R b/tests/testthat/test-ReportCard.R index e6e4eb4a..1a7aff6c 100644 --- a/tests/testthat/test-ReportCard.R +++ b/tests/testthat/test-ReportCard.R @@ -1,5 +1,5 @@ testthat::test_that("ReportCard object can be created", { - testthat::expect_error(ReportCard$new(), regexp = NA) + testthat::expect_no_error(ReportCard$new()) }) testthat::test_that("new returns an object of type ReportCard", { @@ -7,7 +7,7 @@ testthat::test_that("new returns an object of type ReportCard", { }) testthat::test_that("append_text accepts a character", { - testthat::expect_error(ReportCard$new()$append_text("test"), regexp = NA) + testthat::expect_no_error(ReportCard$new()$append_text("test")) }) testthat::test_that("append_text returns self", { @@ -85,8 +85,8 @@ testthat::test_that("append_metadata returns an object of type ReportCard", { }) testthat::test_that("append_metadata accepts a character key and a character or list value", { - testthat::expect_error(ReportCard$new()$append_metadata("key1", "value1"), regexp = NA) - testthat::expect_error(ReportCard$new()$append_metadata("key1", list("value1")), regexp = NA) + testthat::expect_no_error(ReportCard$new()$append_metadata("key1", "value1")) + testthat::expect_no_error(ReportCard$new()$append_metadata("key1", list("value1"))) }) testthat::test_that("append_metadata throws error if key is not character", { diff --git a/tests/testthat/test-Reporter.R b/tests/testthat/test-Reporter.R index d08699d1..6a5f6781 100644 --- a/tests/testthat/test-Reporter.R +++ b/tests/testthat/test-Reporter.R @@ -1,5 +1,5 @@ testthat::test_that("Reporter object can be created", { - testthat::expect_error(Reporter$new(), regexp = NA) + testthat::expect_no_error(Reporter$new()) }) testthat::test_that("new returns an object of type Reporter", { @@ -77,7 +77,7 @@ testthat::test_that("reactive_add_card", { testthat::test_that("append_metadata accept only named list", { reporter <- Reporter$new() - testthat::expect_error(reporter$append_metadata(list(sth = "sth")), NA) + testthat::expect_no_error(reporter$append_metadata(list(sth = "sth"))) testthat::expect_error(reporter$append_metadata("sth"), "'list', not 'character'") testthat::expect_error(reporter$append_metadata(list("sth")), "Must have names") }) @@ -86,13 +86,13 @@ testthat::test_that("append_metadata accept only unique names which could not be reporter <- Reporter$new() testthat::expect_error(reporter$append_metadata(list(sth = "sth", sth = 2)), "but element 2 is duplicated") reporter <- Reporter$new() - testthat::expect_error(reporter$append_metadata(list(sth = "sth")), NA) + testthat::expect_no_error(reporter$append_metadata(list(sth = "sth"))) testthat::expect_error(reporter$append_metadata(list(sth = "sth")), "failed: Must be TRUE") }) testthat::test_that("get_metadata", { reporter <- Reporter$new() - testthat::expect_error(reporter$append_metadata(list(sth = "sth")), NA) + testthat::expect_no_error(reporter$append_metadata(list(sth = "sth"))) testthat::expect_identical(reporter$get_metadata(), list(sth = "sth")) }) diff --git a/tests/testthat/test-TableBlock.R b/tests/testthat/test-TableBlock.R index 17db4465..fe51d90b 100644 --- a/tests/testthat/test-TableBlock.R +++ b/tests/testthat/test-TableBlock.R @@ -1,5 +1,5 @@ testthat::test_that("TableBlock object can be created", { - testthat::expect_error(TableBlock$new(), regexp = NA) + testthat::expect_no_error(TableBlock$new()) }) testthat::test_that("new returns an object of type TableBlock", { @@ -8,7 +8,7 @@ testthat::test_that("new returns an object of type TableBlock", { testthat::test_that("set_content accepts a table object", { block <- TableBlock$new() - testthat::expect_error(block$set_content(iris), regexp = NA) + testthat::expect_no_error(block$set_content(iris)) }) testthat::test_that("set_content asserts the argument is a plot", { @@ -52,7 +52,7 @@ testthat::test_that("from_list after to_list to save and retrive", { testthat::test_that("set_content supports data.frame object", { block <- TableBlock$new() - testthat::expect_error(block$set_content(iris), NA) + testthat::expect_no_error(block$set_content(iris)) }) testthat::test_that("set_content supports rtables object", { @@ -65,5 +65,5 @@ testthat::test_that("set_content supports rtables object", { "range" = diff(range(x)) ) }) - testthat::expect_error(block$set_content(rtables::build_table(l, iris)), NA) + testthat::expect_no_error(block$set_content(rtables::build_table(l, iris))) }) diff --git a/tests/testthat/test-TextBlock.R b/tests/testthat/test-TextBlock.R index 8dbc12aa..faa30b04 100644 --- a/tests/testthat/test-TextBlock.R +++ b/tests/testthat/test-TextBlock.R @@ -1,5 +1,5 @@ testthat::test_that("TextBlock object can be created", { - testthat::expect_error(TextBlock$new(), regexp = NA) + testthat::expect_no_error(TextBlock$new()) }) testthat::test_that("new returns an object of type TextBlock", { @@ -8,7 +8,7 @@ testthat::test_that("new returns an object of type TextBlock", { testthat::test_that("set_content accepts a string", { block <- TextBlock$new() - testthat::expect_error(block$set_content("test"), regexp = NA) + testthat::expect_no_error(block$set_content("test")) }) testthat::test_that("set_content asserts the argument is a string", { @@ -35,7 +35,7 @@ testthat::test_that("get_available_styles returns an array of character", { testthat::test_that("set_style accepts one of the styles returned by get_available_styles", { for (style in TextBlock$new()$get_available_styles()) { - testthat::expect_error(TextBlock$new()$set_style(!!style), regexp = NA) + testthat::expect_no_error(TextBlock$new()$set_style(!!style)) } }) diff --git a/tests/testthat/test-yaml_utils.R b/tests/testthat/test-yaml_utils.R index f337dc0c..8d47dacb 100644 --- a/tests/testthat/test-yaml_utils.R +++ b/tests/testthat/test-yaml_utils.R @@ -13,7 +13,7 @@ testthat::test_that("yaml_quoted does not modify the value of the object", { testthat::test_that("conv_str_logi - accept only a string", { testthat::expect_error(conv_str_logi(2)) - testthat::expect_error(conv_str_logi("string"), NA) + testthat::expect_no_error(conv_str_logi("string")) }) testthat::test_that("conv_str_logi - not influence the regular character", { @@ -47,8 +47,8 @@ testthat::test_that("rmd_outputs - all returned out in the rmarkdown namespace", testthat::test_that("rmd_output_arguments - accepts only string from possible rmarkdown outputs", { testthat::expect_error(rmd_output_arguments("random_text")) - testthat::expect_error(rmd_output_arguments("pdf_document"), NA) - testthat::expect_error(rmd_output_arguments("pdf_document", TRUE), NA) + testthat::expect_no_error(rmd_output_arguments("pdf_document")) + testthat::expect_no_error(rmd_output_arguments("pdf_document", TRUE)) }) testthat::test_that("rmd_output_arguments - returned all pdf_document arguments", { @@ -69,8 +69,8 @@ testthat::test_that("as_yaml_auto - accept a named list (optionally nested)", { testthat::expect_error(as_yaml_auto(list(1))) testthat::expect_error(as_yaml_auto("sth")) - testthat::expect_error(as_yaml_auto(list(author = "", output = list(pdf_document = list(toc = TRUE)))), NA) - testthat::expect_error(as_yaml_auto(list(author = "", output = "pdf_document", toc = TRUE, keep_tex = TRUE)), NA) + testthat::expect_no_error(as_yaml_auto(list(author = "", output = list(pdf_document = list(toc = TRUE))))) + testthat::expect_no_error(as_yaml_auto(list(author = "", output = "pdf_document", toc = TRUE, keep_tex = TRUE))) }) testthat::test_that("as_yaml_auto - works the same as yaml::as.yaml for a nested list when as_header is FALSE", {