From 887fb750e05ced7c745b30bbca0480e9d510810a Mon Sep 17 00:00:00 2001 From: Hadley Wickham Date: Wed, 22 Nov 2023 12:59:47 -0600 Subject: [PATCH] Update snapshots (#311) And suppress a message --- DESCRIPTION | 2 +- tests/testthat/_snaps/color.md | 35 ++++++++++++++++++++-------------- tests/testthat/_snaps/glue.md | 30 +++++++++++++++++------------ tests/testthat/test-glue.R | 2 +- 4 files changed, 41 insertions(+), 28 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 15cdff1..cea197a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -29,7 +29,7 @@ Suggests: magrittr, rmarkdown, RSQLite, - testthat (>= 3.0.0), + testthat (>= 3.2.0), vctrs (>= 0.3.0), waldo (>= 0.3.0), withr diff --git a/tests/testthat/_snaps/color.md b/tests/testthat/_snaps/color.md index ec24cbe..ffed6a5 100644 --- a/tests/testthat/_snaps/color.md +++ b/tests/testthat/_snaps/color.md @@ -2,8 +2,9 @@ Code glue_col("{%}") - Error - :1:1: unexpected input + Condition + Error in `parse()`: + ! :1:1: unexpected input 1: % ^ @@ -11,41 +12,47 @@ Code glue_col("{foo %}") - Error - object 'foo' of mode 'function' was not found + Condition + Error in `get()`: + ! object 'foo' of mode 'function' was not found --- Code glue_col("{foo %}") - Error - object 'foo' of mode 'function' was not found + Condition + Error in `get()`: + ! object 'foo' of mode 'function' was not found # glue_col() can exploit the `.literal` argument Code glue_col("Colorless {green idea's} sleep furiously") - Error - Unterminated quote (') + Condition + Error in `glue_data()`: + ! Unterminated quote (') --- Code glue_col("Colorless {green idea\"s} sleep furiously") - Error - Unterminated quote (") + Condition + Error in `glue_data()`: + ! Unterminated quote (") --- Code glue_col("Colorless {green idea`s} sleep furiously") - Error - Unterminated quote (`) + Condition + Error in `glue_data()`: + ! Unterminated quote (`) --- Code glue_col("Hey a URL: {blue https://example.com/#section}") - Error - A '#' comment in a glue expression must terminate with a newline. + Condition + Error in `glue_data()`: + ! A '#' comment in a glue expression must terminate with a newline. diff --git a/tests/testthat/_snaps/glue.md b/tests/testthat/_snaps/glue.md index 570b5e0..0e8e90b 100644 --- a/tests/testthat/_snaps/glue.md +++ b/tests/testthat/_snaps/glue.md @@ -2,38 +2,44 @@ Code as_glue("a") + 1 - Error - RHS must be a character vector. + Condition + Error in `+.glue`: + ! RHS must be a character vector. Code 1 + as_glue("a") - Error - LHS must be a character vector. + Condition + Error in `+.glue`: + ! LHS must be a character vector. # `+` method errors for inputs of incompatible size Code as_glue(letters[1:2]) + letters[1:3] - Error - Variables must be length 1 or 3 + Condition + Error: + ! Variables must be length 1 or 3 # unterminated comment Code glue("pre {1 + 5 # comment} post") - Error - A '#' comment in a glue expression must terminate with a newline. + Condition + Error in `glue_data()`: + ! A '#' comment in a glue expression must terminate with a newline. --- Code glue("pre {1 + 5 # comment") - Error - A '#' comment in a glue expression must terminate with a newline. + Condition + Error in `glue_data()`: + ! A '#' comment in a glue expression must terminate with a newline. # `.literal` treats quotes and `#` as regular characters Code glue("{'fo`o\"#}", .transformer = function(x, ...) x) - Error - Unterminated quote (') + Condition + Error in `glue_data()`: + ! Unterminated quote (') diff --git a/tests/testthat/test-glue.R b/tests/testthat/test-glue.R index 4f4bb6d..eb64da7 100644 --- a/tests/testthat/test-glue.R +++ b/tests/testthat/test-glue.R @@ -502,7 +502,7 @@ test_that("throws informative error if interpolating a function", { expect_error(glue("{cat}"), "is a function") # some crayon functions are OK, make sure this still works - if (require("crayon")) { + if (require("crayon", quietly = TRUE)) { expect_s3_class(glue("{red}red{reset}"), "glue") } })