Skip to content

Commit 64a422f

Browse files
Remove unused testing helper: generate_test_samples()
1 parent 4f78252 commit 64a422f

File tree

1 file changed

+0
-42
lines changed

1 file changed

+0
-42
lines changed

R/testing.R

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -269,48 +269,6 @@ n_times_faster_bench <- function(i, x1, x2, fun, ..., n, clear) {
269269
)
270270
}
271271

272-
273-
#' Generate a comprehensive collection test cases for comment / insertion
274-
#' interaction
275-
#' Test consist of if / if-else / if-else-if-else cases, paired with various
276-
#' line-break and comment configurations. Used for internal testing.
277-
#' @return
278-
#' The function is called for its side effects, i.e. to write the
279-
#' test cases to *-in.R files that can be tested with [test_collection()]. Note
280-
#' that a few of the test cases are invalid and need to be removed / commented
281-
#' out manually.
282-
#' @keywords internal
283-
generate_test_samples <- function() {
284-
gen <- function(x) {
285-
if (length(x) == 0L) {
286-
""
287-
} else {
288-
c(
289-
paste0(x[1L], gen(x[-1L])),
290-
paste0(x[1L], " # comment\n", paste(x[-1L], collapse = ""))
291-
)
292-
}
293-
}
294-
295-
collapse <- function(x) paste(x, collapse = "\n\n")
296-
297-
cat(
298-
collapse(gen(c("if", "(", "TRUE", ")", "NULL"))),
299-
file = "tests/testthat/insertion_comment_interaction/just_if-in.R"
300-
)
301-
cat(
302-
collapse(gen(c("if", "(", "TRUE", ")", "NULL", " else", " NULL"))),
303-
file = "tests/testthat/insertion_comment_interaction/if_else-in.R"
304-
)
305-
cat(
306-
collapse(gen(c(
307-
"if", "(", "TRUE", ")", "NULL", " else", " if", "(", "FALSE", ")", "NULL",
308-
" else", " NULL"
309-
))),
310-
file = "tests/testthat/insertion_comment_interaction/if_else_if_else-in.R"
311-
)
312-
}
313-
314272
#' @include ui-caching.R
315273
clear_testthat_cache <- purrr::partial(cache_clear, "testthat", ask = FALSE)
316274
activate_testthat_cache <- purrr::partial(cache_activate, "testthat")

0 commit comments

Comments
 (0)