Skip to content

Commit 022e148

Browse files
committed
Fix tests following change to warn on CRAN
1 parent aa7a7ef commit 022e148

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

tests/testthat/test-utils.R

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ test_that("check_params_for_na allows clean parameters", {
1616
})
1717

1818
test_that("check_params_for_na detects NA in simple vectors", {
19+
skip_on_cran() # Skip on CRAN as we current throw warning only on CRAN
1920
bad_params <- list(values = c(1, NA, 3))
2021

2122
expect_snapshot(
@@ -25,6 +26,7 @@ test_that("check_params_for_na detects NA in simple vectors", {
2526
})
2627

2728
test_that("check_params_for_na detects NA in nested structures", {
29+
skip_on_cran() # Skip on CRAN as we current throw warning only on CRAN
2830
nested_params <- list(
2931
data = list(
3032
subset = c(1, NA, 3)
@@ -38,6 +40,7 @@ test_that("check_params_for_na detects NA in nested structures", {
3840
})
3941

4042
test_that("check_params_for_na shows correct NA positions", {
43+
skip_on_cran() # Skip on CRAN as we current throw warning only on CRAN
4144
multi_na_params <- list(x = c(1, NA, 3, NA, 5))
4245

4346
expect_snapshot(
@@ -47,6 +50,7 @@ test_that("check_params_for_na shows correct NA positions", {
4750
})
4851

4952
test_that("check_params_for_na handles different NA types", {
53+
skip_on_cran() # Skip on CRAN as we current throw warning only on CRAN
5054
# Test different NA types
5155
expect_error(
5256
check_params_for_na(list(x = NA_real_)),
@@ -70,23 +74,25 @@ test_that("check_params_for_na handles different NA types", {
7074
})
7175

7276
test_that("as_yaml detects NA in simple vectors", {
77+
skip_on_cran() # Skip on CRAN as we current throw warning only on CRAN
7378
expect_snapshot(
74-
as_yaml(list(values = c(1, NA, 3))),
75-
error = TRUE
79+
error = TRUE,
80+
as_yaml(list(values = c(1, NA, 3)))
7681
)
7782
})
7883

7984
test_that("write_yaml detects NA in nested structures", {
85+
skip_on_cran() # Skip on CRAN as we current throw warning only on CRAN
8086
expect_snapshot(
81-
write_yaml(list(data = list(subset = c(1, NA, 3))), tempfile()),
82-
error = TRUE
87+
error = TRUE?write_yaml(list(data = list(subset = c(1, NA, 3))), tempfile())
8388
)
8489
})
8590

8691
test_that("as_yaml shows correct NA positions", {
92+
skip_on_cran() # Skip on CRAN as we current throw warning only on CRAN
8793
expect_snapshot(
88-
as_yaml(list(x = c(1, NA, 3, NA))),
89-
error = TRUE
94+
error = TRUE,
95+
as_yaml(list(x = c(1, NA, 3, NA)))
9096
)
9197
})
9298

@@ -105,9 +111,10 @@ test_that("write_yaml allows clean data", {
105111
})
106112

107113
test_that("quarto_render uses write_yaml validation", {
114+
skip_on_cran() # Skip on CRAN as we current throw warning only on CRAN
108115
expect_snapshot(
109-
quarto_render("test.qmd", execute_params = list(bad_param = c(1, NA))),
110-
error = TRUE
116+
error = TRUE,
117+
quarto_render("test.qmd", execute_params = list(bad_param = c(1, NA)))
111118
)
112119
})
113120

0 commit comments

Comments
 (0)