Skip to content

Commit 3394099

Browse files
Merge pull request #1212 from r-lib/rm-generate_test_samples
2 parents 6db6eff + 156b6d0 commit 3394099

File tree

2 files changed

+0
-66
lines changed

2 files changed

+0
-66
lines changed

R/testing.R

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

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

man/generate_test_samples.Rd

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)