From 23eb8a3fb6d88067bc217bef616c90dc1581d082 Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Thu, 28 Nov 2024 21:36:00 +0100 Subject: [PATCH] add tests --- tests/testthat/line_breaks_and_other/curly-in.R | 9 +++++++++ tests/testthat/line_breaks_and_other/curly-out.R | 6 ++++++ .../line_breaks_and_other/pipe_and_comment-in.R | 9 +++++++++ .../line_breaks_and_other/pipe_and_comment-out.R | 6 ++++++ .../line_breaks_fun_call/blank-non-strict-in.R | 4 ++++ .../line_breaks_fun_call/blank-non-strict-out.R | 1 + .../30-multiple-empty-lines-between-in.R | 16 ++++++++++++++++ .../30-multiple-empty-lines-between-out.R | 13 +++++++++++++ .../testthat/test-roxygen-examples-complete-30.R | 5 +++++ 9 files changed, 69 insertions(+) create mode 100644 tests/testthat/roxygen-examples-complete/30-multiple-empty-lines-between-in.R create mode 100644 tests/testthat/roxygen-examples-complete/30-multiple-empty-lines-between-out.R create mode 100644 tests/testthat/test-roxygen-examples-complete-30.R diff --git a/tests/testthat/line_breaks_and_other/curly-in.R b/tests/testthat/line_breaks_and_other/curly-in.R index 8da4db732..31e6fc468 100644 --- a/tests/testthat/line_breaks_and_other/curly-in.R +++ b/tests/testthat/line_breaks_and_other/curly-in.R @@ -59,3 +59,12 @@ while (TRUE){ while (TRUE){# } + + +for (i in 1:10) {} + + + + + +while (TRUE) {} diff --git a/tests/testthat/line_breaks_and_other/curly-out.R b/tests/testthat/line_breaks_and_other/curly-out.R index 22730a44b..753c2a853 100644 --- a/tests/testthat/line_breaks_and_other/curly-out.R +++ b/tests/testthat/line_breaks_and_other/curly-out.R @@ -53,3 +53,9 @@ while (TRUE) { while (TRUE) { # } + + +for (i in 1:10) {} + + +while (TRUE) {} diff --git a/tests/testthat/line_breaks_and_other/pipe_and_comment-in.R b/tests/testthat/line_breaks_and_other/pipe_and_comment-in.R index f0dcfb1d5..6f3ca4fb4 100644 --- a/tests/testthat/line_breaks_and_other/pipe_and_comment-in.R +++ b/tests/testthat/line_breaks_and_other/pipe_and_comment-in.R @@ -1,2 +1,11 @@ 1:10 %>% # sum sum() + + +f %>% g() + + + + + +h %>% i() diff --git a/tests/testthat/line_breaks_and_other/pipe_and_comment-out.R b/tests/testthat/line_breaks_and_other/pipe_and_comment-out.R index f0dcfb1d5..bad0b84a2 100644 --- a/tests/testthat/line_breaks_and_other/pipe_and_comment-out.R +++ b/tests/testthat/line_breaks_and_other/pipe_and_comment-out.R @@ -1,2 +1,8 @@ 1:10 %>% # sum sum() + + +f %>% g() + + +h %>% i() diff --git a/tests/testthat/line_breaks_fun_call/blank-non-strict-in.R b/tests/testthat/line_breaks_fun_call/blank-non-strict-in.R index 21225f5f8..cf1631c36 100644 --- a/tests/testthat/line_breaks_fun_call/blank-non-strict-in.R +++ b/tests/testthat/line_breaks_fun_call/blank-non-strict-in.R @@ -10,6 +10,10 @@ call( 1 ) + + + + call( x = 2, 1, diff --git a/tests/testthat/line_breaks_fun_call/blank-non-strict-out.R b/tests/testthat/line_breaks_fun_call/blank-non-strict-out.R index 02330a9ec..024a4c205 100644 --- a/tests/testthat/line_breaks_fun_call/blank-non-strict-out.R +++ b/tests/testthat/line_breaks_fun_call/blank-non-strict-out.R @@ -8,6 +8,7 @@ call( 1 ) + call( x = 2, 1, diff --git a/tests/testthat/roxygen-examples-complete/30-multiple-empty-lines-between-in.R b/tests/testthat/roxygen-examples-complete/30-multiple-empty-lines-between-in.R new file mode 100644 index 000000000..880595599 --- /dev/null +++ b/tests/testthat/roxygen-examples-complete/30-multiple-empty-lines-between-in.R @@ -0,0 +1,16 @@ +#' Empty line in examples +#' +#' @examples +1 + + + + + + +#' Empty line in examples +#' +#' @examples +#' \dontrun{ +#' } +2 diff --git a/tests/testthat/roxygen-examples-complete/30-multiple-empty-lines-between-out.R b/tests/testthat/roxygen-examples-complete/30-multiple-empty-lines-between-out.R new file mode 100644 index 000000000..8871734b8 --- /dev/null +++ b/tests/testthat/roxygen-examples-complete/30-multiple-empty-lines-between-out.R @@ -0,0 +1,13 @@ +#' Empty line in examples +#' +#' @examples +1 + + +#' Empty line in examples +#' +#' @examples +#' \dontrun{ +#' +#' } +2 diff --git a/tests/testthat/test-roxygen-examples-complete-30.R b/tests/testthat/test-roxygen-examples-complete-30.R new file mode 100644 index 000000000..f81bab588 --- /dev/null +++ b/tests/testthat/test-roxygen-examples-complete-30.R @@ -0,0 +1,5 @@ +# NB: DO NOT EDIT. Auto-generated by ./tests/dev/generate_roxygen_tests.R. + +test_that("analogous to test-roxygen-examples-complete: 30", { + expect_warning(test_collection("roxygen-examples-complete", "^30-", transformer = style_text), NA) +})