From b519cc52c2021929d31fb3c8b3c47f54cec1a8e6 Mon Sep 17 00:00:00 2001 From: Josiah Parry Date: Sat, 30 Dec 2023 09:04:47 -0500 Subject: [PATCH 1/3] remove global variable note and change vendor test to print packages not versions --- R/cran-compliance.R | 2 +- tests/testthat/_snaps/use_cran_defaults.md | 26 +++++++++++----------- tests/testthat/test-use_cran_defaults.R | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/R/cran-compliance.R b/R/cran-compliance.R index 6fef5b36..95b88354 100644 --- a/R/cran-compliance.R +++ b/R/cran-compliance.R @@ -191,7 +191,7 @@ vendor_pkgs <- function(path = ".", quiet = FALSE, overwrite = NULL) { rlang::set_names(c("source", "crate", "version")) %>% dplyr::filter(!is.na(source)) %>% dplyr::select(-source) %>% - dplyr::arrange(crate) # nolint: object_usage_linter + dplyr::arrange(.data$crate) # nolint: object_usage_linter # capture vendor-config.toml content config_toml <- vendor_res[["stdout"]] %>% diff --git a/tests/testthat/_snaps/use_cran_defaults.md b/tests/testthat/_snaps/use_cran_defaults.md index aa9b6355..a203701b 100644 --- a/tests/testthat/_snaps/use_cran_defaults.md +++ b/tests/testthat/_snaps/use_cran_defaults.md @@ -181,18 +181,18 @@ --- Code - package_versions + package_versions["crate"] Output - # A tibble: 9 x 2 - crate version - - 1 extendr-api 0.6.0 - 2 extendr-macros 0.6.0 - 3 libR-sys 0.6.0 - 4 once_cell 1.19.0 - 5 paste 1.0.14 - 6 proc-macro2 1.0.70 - 7 quote 1.0.33 - 8 syn 2.0.42 - 9 unicode-ident 1.0.12 + # A tibble: 9 x 1 + crate + + 1 extendr-api + 2 extendr-macros + 3 libR-sys + 4 once_cell + 5 paste + 6 proc-macro2 + 7 quote + 8 syn + 9 unicode-ident diff --git a/tests/testthat/test-use_cran_defaults.R b/tests/testthat/test-use_cran_defaults.R index 83ee5ad3..4ad26749 100644 --- a/tests/testthat/test-use_cran_defaults.R +++ b/tests/testthat/test-use_cran_defaults.R @@ -35,6 +35,6 @@ test_that("vendor_pkgs() vendors dependencies", { package_versions <- vendor_pkgs(path, quiet = TRUE) expect_snapshot(cat_file("src", "rust", "vendor-config.toml")) - expect_snapshot(package_versions) + expect_snapshot(package_versions["crate"]) expect_true(file.exists(file.path("src", "rust", "vendor.tar.xz"))) }) From 2a25ec13ed783f05d25d296c5f4a51305651a0e9 Mon Sep 17 00:00:00 2001 From: Josiah Parry Date: Fri, 12 Jan 2024 17:46:18 -0500 Subject: [PATCH 2/3] revert snapshot test and remove lint --- R/cran-compliance.R | 2 +- tests/testthat/_snaps/use_cran_defaults.md | 26 +++++++++++----------- tests/testthat/test-use_cran_defaults.R | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/R/cran-compliance.R b/R/cran-compliance.R index 95b88354..0ed1790e 100644 --- a/R/cran-compliance.R +++ b/R/cran-compliance.R @@ -191,7 +191,7 @@ vendor_pkgs <- function(path = ".", quiet = FALSE, overwrite = NULL) { rlang::set_names(c("source", "crate", "version")) %>% dplyr::filter(!is.na(source)) %>% dplyr::select(-source) %>% - dplyr::arrange(.data$crate) # nolint: object_usage_linter + dplyr::arrange(.data$crate) # capture vendor-config.toml content config_toml <- vendor_res[["stdout"]] %>% diff --git a/tests/testthat/_snaps/use_cran_defaults.md b/tests/testthat/_snaps/use_cran_defaults.md index a203701b..a7b826b6 100644 --- a/tests/testthat/_snaps/use_cran_defaults.md +++ b/tests/testthat/_snaps/use_cran_defaults.md @@ -181,18 +181,18 @@ --- Code - package_versions["crate"] + package_versions Output - # A tibble: 9 x 1 - crate - - 1 extendr-api - 2 extendr-macros - 3 libR-sys - 4 once_cell - 5 paste - 6 proc-macro2 - 7 quote - 8 syn - 9 unicode-ident + # A tibble: 9 x 2 + crate version + + 1 extendr-api 0.6.0 + 2 extendr-macros 0.6.0 + 3 libR-sys 0.6.0 + 4 once_cell 1.19.0 + 5 paste 1.0.14 + 6 proc-macro2 1.0.76 + 7 quote 1.0.35 + 8 syn 2.0.48 + 9 unicode-ident 1.0.12 diff --git a/tests/testthat/test-use_cran_defaults.R b/tests/testthat/test-use_cran_defaults.R index 4ad26749..83ee5ad3 100644 --- a/tests/testthat/test-use_cran_defaults.R +++ b/tests/testthat/test-use_cran_defaults.R @@ -35,6 +35,6 @@ test_that("vendor_pkgs() vendors dependencies", { package_versions <- vendor_pkgs(path, quiet = TRUE) expect_snapshot(cat_file("src", "rust", "vendor-config.toml")) - expect_snapshot(package_versions["crate"]) + expect_snapshot(package_versions) expect_true(file.exists(file.path("src", "rust", "vendor.tar.xz"))) }) From 538b8700edb17aa2675f03af3d8e85adaf5223b0 Mon Sep 17 00:00:00 2001 From: Josiah Parry Date: Fri, 12 Jan 2024 18:09:34 -0500 Subject: [PATCH 3/3] update snapshot test --- tests/testthat/_snaps/use_cran_defaults.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/testthat/_snaps/use_cran_defaults.md b/tests/testthat/_snaps/use_cran_defaults.md index a7b826b6..84e5994e 100644 --- a/tests/testthat/_snaps/use_cran_defaults.md +++ b/tests/testthat/_snaps/use_cran_defaults.md @@ -186,13 +186,13 @@ # A tibble: 9 x 2 crate version - 1 extendr-api 0.6.0 - 2 extendr-macros 0.6.0 - 3 libR-sys 0.6.0 - 4 once_cell 1.19.0 - 5 paste 1.0.14 - 6 proc-macro2 1.0.76 - 7 quote 1.0.35 - 8 syn 2.0.48 - 9 unicode-ident 1.0.12 + 1 extendr-api *.*.* + 2 extendr-macros *.*.* + 3 libR-sys *.*.* + 4 once_cell *.*.* + 5 paste *.*.* + 6 proc-macro2 *.*.* + 7 quote *.*.* + 8 syn *.*.* + 9 unicode-ident *.*.*