From 299f12ef15d9355e0b869b2e1fc1119c7e4118aa Mon Sep 17 00:00:00 2001 From: Olivier Roy Date: Wed, 20 Dec 2023 09:52:40 -0500 Subject: [PATCH] Remove partial matching --- tests/testthat/test-collapsing.R | 2 +- tests/testthat/test-diff.R | 2 +- tests/testthat/test-format-conditions.R | 4 ++-- tests/testthat/test-inline-2.R | 12 +++++----- tests/testthat/test-inline.R | 2 +- tests/testthat/test-links.R | 30 ++++++++++++------------- tests/testthat/test-rlang-errors.R | 4 ++-- tests/testthat/test-vt.R | 2 +- 8 files changed, 29 insertions(+), 29 deletions(-) diff --git a/tests/testthat/test-collapsing.R b/tests/testthat/test-collapsing.R index 733330885..4923dcc3e 100644 --- a/tests/testthat/test-collapsing.R +++ b/tests/testthat/test-collapsing.R @@ -115,7 +115,7 @@ test_that("both-ends", { }) }) -test_that_cli(config = c("plain", "ansi"), "both-ends with formatting", { +test_that_cli(configs = c("plain", "ansi"), "both-ends with formatting", { v <- function(n, t = 5) { cli_vec( seq_len(n), diff --git a/tests/testthat/test-diff.R b/tests/testthat/test-diff.R index 41254fd09..482973a00 100644 --- a/tests/testthat/test-diff.R +++ b/tests/testthat/test-diff.R @@ -41,7 +41,7 @@ test_that("format.cli_diff_chr context", { expect_snapshot(print(d2, context = Inf)) }) -test_that_cli(config = c("plain", "ansi"), "diff_str", { +test_that_cli(configs = c("plain", "ansi"), "diff_str", { str1 <- "abcdefghijklmnopqrstuvwxyz" str2 <- "PREabcdefgMIDDLEnopqrstuvwxyzPOST" d <- diff_str(str1, str2) diff --git a/tests/testthat/test-format-conditions.R b/tests/testthat/test-format-conditions.R index 63abce6c5..7515ceb99 100644 --- a/tests/testthat/test-format-conditions.R +++ b/tests/testthat/test-format-conditions.R @@ -59,7 +59,7 @@ test_that_cli("format_message", { })) }) -test_that_cli(config = "ansi", "color in RStudio", { +test_that_cli(configs = "ansi", "color in RStudio", { mockery::stub( get_rstudio_fg_color0, "rstudio_detect", @@ -90,7 +90,7 @@ test_that_cli(config = "ansi", "color in RStudio", { expect_null(get_rstudio_fg_color0()) }) -test_that_cli(config = "ansi", "update_rstudio_color", { +test_that_cli(configs = "ansi", "update_rstudio_color", { mockery::stub( update_rstudio_color, "get_rstudio_fg_color", diff --git a/tests/testthat/test-inline-2.R b/tests/testthat/test-inline-2.R index 97bbe6b50..1f3b8c272 100644 --- a/tests/testthat/test-inline-2.R +++ b/tests/testthat/test-inline-2.R @@ -18,7 +18,7 @@ test_that_cli( } ) -test_that_cli(config = c("plain", "ansi"), "quoting weird names, still", { +test_that_cli(configs = c("plain", "ansi"), "quoting weird names, still", { nb <- function(x) gsub("\u00a0", " ", x, fixed = TRUE) expect_snapshot(local({ cat_line(nb(quote_weird_name("good"))) @@ -28,7 +28,7 @@ test_that_cli(config = c("plain", "ansi"), "quoting weird names, still", { })) }) -test_that_cli(config = c("ansi"), "~/ files are not weird", { +test_that_cli(configs = c("ansi"), "~/ files are not weird", { nb <- function(x) gsub("\u00a0", " ", x, fixed = TRUE) expect_snapshot(local({ cat_line(nb(quote_weird_name("~/good"))) @@ -106,7 +106,7 @@ test_that("line breaks", { expect_snapshot(ansi_strwrap(txt2, width = 60)) }) -test_that_cli(config = "ansi", "double ticks", { +test_that_cli(configs = "ansi", "double ticks", { x <- c("a", "`x`", "b") cli_div(theme = list( .code = list(color = "red"), @@ -127,13 +127,13 @@ test_that("do not inherit 'transform' issue #422", { }) }) -test_that_cli(config = c("ansi", "plain"), "no inherit color, issue #474", { +test_that_cli(configs = c("ansi", "plain"), "no inherit color, issue #474", { expect_snapshot({ cli::cli_text("pre {.val x {'foo'} y} post") }) }) -test_that_cli(config = c("ansi", "plain"), "\\f at the end, issue #491", { +test_that_cli(configs = c("ansi", "plain"), "\\f at the end, issue #491", { expect_snapshot({ cli_fmt(cli::cli_text("{.val a}{.val b}")) cli_fmt(cli::cli_text("\f{.val a}{.val b}")) @@ -152,7 +152,7 @@ test_that("truncate vectors at 20", { ) }) -test_that_cli(config = "ansi", "brace expresssion edge cases", { +test_that_cli(configs = "ansi", "brace expresssion edge cases", { foo <- "foo" bar <- "bar" expect_snapshot({ diff --git a/tests/testthat/test-inline.R b/tests/testthat/test-inline.R index fd793e1d8..95d6d9c55 100644 --- a/tests/testthat/test-inline.R +++ b/tests/testthat/test-inline.R @@ -4,7 +4,7 @@ withr::local_options(cli.theme = NULL, cli.user_theme = NULL) start_app() on.exit(stop_app(), add = TRUE) -test_that_cli(config = c("plain", "ansi"), "inline classes", { +test_that_cli(configs = c("plain", "ansi"), "inline classes", { classes <- c( "emph", "strong", "code", "pkg", "fun", "arg", "key", "file", "path", "email", "url", "var", "envvar", "cls") diff --git a/tests/testthat/test-links.R b/tests/testthat/test-links.R index 3275c306f..94dc92e5f 100644 --- a/tests/testthat/test-links.R +++ b/tests/testthat/test-links.R @@ -1,7 +1,7 @@ # -- {.email} ------------------------------------------------------------- -test_that_cli(config = c("plain", "fancy"), links = c("all", "none"), +test_that_cli(configs = c("plain", "fancy"), links = c("all", "none"), "{.email}", { expect_snapshot({ @@ -9,7 +9,7 @@ test_that_cli(config = c("plain", "fancy"), links = c("all", "none"), }) }) -test_that_cli(config = c("plain", "fancy"), links = c("all", "none"), +test_that_cli(configs = c("plain", "fancy"), links = c("all", "none"), "{.email} vectors", { expect_snapshot({ @@ -20,7 +20,7 @@ test_that_cli(config = c("plain", "fancy"), links = c("all", "none"), # -- {.file} and {.path} -------------------------------------------------- -test_that_cli(config = c("plain", "fancy"), links = c("all", "none"), +test_that_cli(configs = c("plain", "fancy"), links = c("all", "none"), "{.file} and {.path}", { withr::local_envvar(R_CLI_HYPERLINK_STYLE = NA_character_) @@ -114,7 +114,7 @@ test_that_cli(config = c("plain", "fancy"), links = c("all", "none"), # -- {.fun} --------------------------------------------------------------- -test_that_cli(config = "plain", links = c("all", "none"), +test_that_cli(configs = "plain", links = c("all", "none"), "{.fun}", { expect_snapshot({ @@ -128,7 +128,7 @@ test_that_cli(config = "plain", links = c("all", "none"), }) }) -test_that_cli(config = "plain", links = "all", "turning off help", { +test_that_cli(configs = "plain", links = "all", "turning off help", { withr::local_options(cli.hyperlink_help = FALSE) expect_snapshot({ cli_text("{.fun pkg::func}") @@ -137,7 +137,7 @@ test_that_cli(config = "plain", links = "all", "turning off help", { # -- {.help} -------------------------------------------------------------- -test_that_cli(config = "plain", links = c("all", "none"), +test_that_cli(configs = "plain", links = c("all", "none"), "{.help}", { expect_snapshot({ @@ -153,7 +153,7 @@ test_that_cli(config = "plain", links = c("all", "none"), # -- {.href} -------------------------------------------------------------- -test_that_cli(config = "plain", links = c("all", "none"), +test_that_cli(configs = "plain", links = c("all", "none"), "{.href}", { expect_snapshot({ cli_text("{.href https://cli.r-lib.org}") @@ -162,7 +162,7 @@ test_that_cli(config = "plain", links = c("all", "none"), }) }) -test_that_cli(config = "plain", links = c("all", "none"), +test_that_cli(configs = "plain", links = c("all", "none"), "{.href} vectors", { expect_snapshot({ url <- paste0("https://cli.r-lib.org/", 1:3) @@ -172,7 +172,7 @@ test_that_cli(config = "plain", links = c("all", "none"), # -- {.run} --------------------------------------------------------------- -test_that_cli(config = "plain", links = c("all", "none"), +test_that_cli(configs = "plain", links = c("all", "none"), "{.run}", { expect_snapshot({ cli_text("{.run pkg::fun(param)}") @@ -180,7 +180,7 @@ test_that_cli(config = "plain", links = c("all", "none"), }) }) -test_that_cli(config = "plain", links = c("all", "none"), +test_that_cli(configs = "plain", links = c("all", "none"), "{.run} vectors", { expect_snapshot({ codes <- paste0("pkg::fun", 1:3, "()") @@ -190,7 +190,7 @@ test_that_cli(config = "plain", links = c("all", "none"), # -- {.topic} ------------------------------------------------------------- -test_that_cli(config = "plain", links = c("all", "none"), +test_that_cli(configs = "plain", links = c("all", "none"), "{.topic}", { expect_snapshot({ @@ -206,14 +206,14 @@ test_that_cli(config = "plain", links = c("all", "none"), # -- {.url} --------------------------------------------------------------- -test_that_cli(config = c("plain", "fancy"), links = c("all", "none"), +test_that_cli(configs = c("plain", "fancy"), links = c("all", "none"), "{.url}", { expect_snapshot({ cli_text("{.url https://cli.r-lib.org}") }) }) -test_that_cli(config = c("plain", "fancy"), links = c("all", "none"), +test_that_cli(configs = c("plain", "fancy"), links = c("all", "none"), "{.url} vector", { expect_snapshot({ urls <- paste0("https://cli.r-lib.org/", 1:3) @@ -221,7 +221,7 @@ test_that_cli(config = c("plain", "fancy"), links = c("all", "none"), }) }) -test_that_cli(config = "plain", links = "all", "linked {.url}", { +test_that_cli(configs = "plain", links = "all", "linked {.url}", { expect_snapshot({ link <- c( "https://cli.r-lib.org", @@ -239,7 +239,7 @@ test_that("make_link_url", { # -- {.vignette} ---------------------------------------------------------- -test_that_cli(config = "plain", links = c("all", "none"), +test_that_cli(configs = "plain", links = c("all", "none"), "{.vignette}", { expect_snapshot({ diff --git a/tests/testthat/test-rlang-errors.R b/tests/testthat/test-rlang-errors.R index d92c436ef..ae32d8571 100644 --- a/tests/testthat/test-rlang-errors.R +++ b/tests/testthat/test-rlang-errors.R @@ -92,7 +92,7 @@ test_that("cli_abort width in RStudio", { })) }) -test_that_cli(config = "ansi", "color in RStudio", { +test_that_cli(configs = "ansi", "color in RStudio", { mockery::stub( get_rstudio_fg_color0, "rstudio_detect", @@ -123,7 +123,7 @@ test_that_cli(config = "ansi", "color in RStudio", { expect_null(get_rstudio_fg_color0()) }) -test_that_cli(config = "ansi", "update_rstudio_color", { +test_that_cli(configs = "ansi", "update_rstudio_color", { mockery::stub( update_rstudio_color, "get_rstudio_fg_color", diff --git a/tests/testthat/test-vt.R b/tests/testthat/test-vt.R index 68e60c906..4d51d00f9 100644 --- a/tests/testthat/test-vt.R +++ b/tests/testthat/test-vt.R @@ -35,7 +35,7 @@ test_that("scroll up", { ) }) -test_that_cli(config = "ansi", "ANSI SGR", { +test_that_cli(configs = "ansi", "ANSI SGR", { expect_snapshot( vt_output("12\033[31m34\033[1m56\033[39m78\033[21m90", width = 20, height = 2) )