From a87a40ac9db23b709a943c4980c093000143deb0 Mon Sep 17 00:00:00 2001 From: Jenny Bryan Date: Tue, 13 Feb 2024 10:15:22 -0800 Subject: [PATCH] writeLines() is better --- tests/testthat/_snaps/upkeep.md | 37 ++++++++++++++++++--------------- tests/testthat/test-upkeep.R | 5 ++++- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/tests/testthat/_snaps/upkeep.md b/tests/testthat/_snaps/upkeep.md index 8ad1fe5ad..f7aad90e3 100644 --- a/tests/testthat/_snaps/upkeep.md +++ b/tests/testthat/_snaps/upkeep.md @@ -85,22 +85,25 @@ --- Code - print(checklist) + writeLines(checklist) Output - [1] "* [ ] `usethis::use_readme_rmd()`" - [2] "* [ ] `usethis::use_github_links()`" - [3] "* [ ] `usethis::use_pkgdown_github_pages()`" - [4] "* [ ] `usethis::use_tidy_description()`" - [5] "* [ ] `usethis::use_package_doc()`\nConsider letting usethis manage your `@importFrom` directives here. `usethis::use_import_from()` is handy for this." - [6] "* [ ] `usethis::use_testthat(3)` and upgrade to 3e, [testthat 3e vignette](https://testthat.r-lib.org/articles/third-edition.html)" - [7] "* [ ] Align the names of `R/` files and `test/` files for workflow happiness. The docs for `usethis::use_r()` include a helpful script. `usethis::rename_files()` may be be useful." - [8] "* [ ] Consider changing default branch from `master` to `main`" - [9] "* [ ] Remove description of test environments from `cran-comments.md`.\nSee `usethis::use_cran_comments()`." - [10] "* [ ] Add alt-text to pictures, plots, etc; see for examples" - [11] "" - [12] "Set up or update GitHub Actions. \\\n Updating workflows to the latest version will often fix troublesome actions:" - [13] "* [ ] `usethis::use_github_action('check-standard')`" - [14] "* [ ] `usethis::use_github_action('test-coverage')`" - [15] "" - [16] "Created on 2023-01-01 with `usethis::use_upkeep_issue()`, using [usethis v1.1.0](https://usethis.r-lib.org)" + * [ ] `usethis::use_readme_rmd()` + * [ ] `usethis::use_github_links()` + * [ ] `usethis::use_pkgdown_github_pages()` + * [ ] `usethis::use_tidy_description()` + * [ ] `usethis::use_package_doc()` + Consider letting usethis manage your `@importFrom` directives here. `usethis::use_import_from()` is handy for this. + * [ ] `usethis::use_testthat(3)` and upgrade to 3e, [testthat 3e vignette](https://testthat.r-lib.org/articles/third-edition.html) + * [ ] Align the names of `R/` files and `test/` files for workflow happiness. The docs for `usethis::use_r()` include a helpful script. `usethis::rename_files()` may be be useful. + * [ ] Consider changing default branch from `master` to `main` + * [ ] Remove description of test environments from `cran-comments.md`. + See `usethis::use_cran_comments()`. + * [ ] Add alt-text to pictures, plots, etc; see for examples + + Set up or update GitHub Actions. \ + Updating workflows to the latest version will often fix troublesome actions: + * [ ] `usethis::use_github_action('check-standard')` + * [ ] `usethis::use_github_action('test-coverage')` + + Created on 2023-01-01 with `usethis::use_upkeep_issue()`, using [usethis v1.1.0](https://usethis.r-lib.org) diff --git a/tests/testthat/test-upkeep.R b/tests/testthat/test-upkeep.R index fb251d93c..876add3a8 100644 --- a/tests/testthat/test-upkeep.R +++ b/tests/testthat/test-upkeep.R @@ -37,12 +37,15 @@ test_that("upkeep bullets don't change accidentally",{ desc::desc_del("Suggests") use_package("testthat", "Suggests") + # previously (withr 2.5.0) we could put local_edition(2L) inside {..} inside + # the expect_snapshot() call + # that is no longer true with withr 3.0.0, but this hacktastic approach works local({ local_edition(2L) checklist <<- upkeep_checklist() }) - expect_snapshot(print(checklist)) + expect_snapshot(writeLines(checklist)) }) test_that("get extra upkeep bullets works", {