From 64a422fd1f5316ab60812d96a11695af38761b6a Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Wed, 15 May 2024 21:43:02 +0200 Subject: [PATCH 1/2] Remove unused testing helper: `generate_test_samples()` --- R/testing.R | 42 ------------------------------------------ 1 file changed, 42 deletions(-) diff --git a/R/testing.R b/R/testing.R index f2c8ffe6b..76bed0416 100644 --- a/R/testing.R +++ b/R/testing.R @@ -269,48 +269,6 @@ n_times_faster_bench <- function(i, x1, x2, fun, ..., n, clear) { ) } - -#' Generate a comprehensive collection test cases for comment / insertion -#' interaction -#' Test consist of if / if-else / if-else-if-else cases, paired with various -#' line-break and comment configurations. Used for internal testing. -#' @return -#' The function is called for its side effects, i.e. to write the -#' test cases to *-in.R files that can be tested with [test_collection()]. Note -#' that a few of the test cases are invalid and need to be removed / commented -#' out manually. -#' @keywords internal -generate_test_samples <- function() { - gen <- function(x) { - if (length(x) == 0L) { - "" - } else { - c( - paste0(x[1L], gen(x[-1L])), - paste0(x[1L], " # comment\n", paste(x[-1L], collapse = "")) - ) - } - } - - collapse <- function(x) paste(x, collapse = "\n\n") - - cat( - collapse(gen(c("if", "(", "TRUE", ")", "NULL"))), - file = "tests/testthat/insertion_comment_interaction/just_if-in.R" - ) - cat( - collapse(gen(c("if", "(", "TRUE", ")", "NULL", " else", " NULL"))), - file = "tests/testthat/insertion_comment_interaction/if_else-in.R" - ) - cat( - collapse(gen(c( - "if", "(", "TRUE", ")", "NULL", " else", " if", "(", "FALSE", ")", "NULL", - " else", " NULL" - ))), - file = "tests/testthat/insertion_comment_interaction/if_else_if_else-in.R" - ) -} - #' @include ui-caching.R clear_testthat_cache <- purrr::partial(cache_clear, "testthat", ask = FALSE) activate_testthat_cache <- purrr::partial(cache_activate, "testthat") From 156b6d06f29df649e097a9048ecbd423951c8159 Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Wed, 15 May 2024 21:46:23 +0200 Subject: [PATCH 2/2] Delete generate_test_samples.Rd --- man/generate_test_samples.Rd | 24 ------------------------ 1 file changed, 24 deletions(-) delete mode 100644 man/generate_test_samples.Rd diff --git a/man/generate_test_samples.Rd b/man/generate_test_samples.Rd deleted file mode 100644 index 40177fc80..000000000 --- a/man/generate_test_samples.Rd +++ /dev/null @@ -1,24 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/testing.R -\name{generate_test_samples} -\alias{generate_test_samples} -\title{Generate a comprehensive collection test cases for comment / insertion -interaction -Test consist of if / if-else / if-else-if-else cases, paired with various -line-break and comment configurations. Used for internal testing.} -\usage{ -generate_test_samples() -} -\value{ -The function is called for its side effects, i.e. to write the -test cases to *-in.R files that can be tested with \code{\link[=test_collection]{test_collection()}}. Note -that a few of the test cases are invalid and need to be removed / commented -out manually. -} -\description{ -Generate a comprehensive collection test cases for comment / insertion -interaction -Test consist of if / if-else / if-else-if-else cases, paired with various -line-break and comment configurations. Used for internal testing. -} -\keyword{internal}