Skip to content

Commit 584a3db

Browse files
committed
test-compat-terra.R: relax regex for R-oldrel on macOS *
Following failure was seen in r-spatial.r-universe.dev, but not in https://cran.r-project.org/web/checks/check_results_qgisprocess.html : ── Failure ('test-compat-terra.R:245:3'): terra argument coercers work for SpatVectorProxy ── as_qgis_argument\(obj, qgis_argument_spec\(qgis_type = "point"\)\) does not match "^[\\de\\+]+,[\\de\\+]+\\[\\w+:\\d+\\]$". Actual value: "7e\+05,7e\+05" Backtrace: ▆ 1. └─testthat::expect_match(...) at test-compat-terra.R:245:3 2. └─testthat:::expect_match_(...) [ FAIL 2 | WARN 6 | SKIP 59 | PASS 260 ] Error: Test failures Execution halted This commit relaxes the regex match for qgis argument type 'point' in case of SpatVectorProxy, specifically in R < 4.3 on macOS. Notably, it appears that on macOS R-oldrel `terra::crs(x, describe = TRUE)[, c("authority", "code")]` does not return the same as in other systems / R-releases; instead this result must have at least one NA value.
1 parent b363ccc commit 584a3db

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

tests/testthat/test-compat-terra.R

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -242,11 +242,19 @@ test_that("terra argument coercers work for SpatVectorProxy", {
242242
tmp_file
243243
)
244244
obj <- terra::vect(tmp_file, proxy = TRUE)
245-
expect_match(
246-
as_qgis_argument(obj, qgis_argument_spec(qgis_type = "point")),
247-
"^[\\de\\+]+,[\\de\\+]+\\[\\w+:\\d+\\]$",
248-
perl = TRUE
249-
)
245+
if (getRversion() < "4.3" && is_macos()) {
246+
expect_match(
247+
as_qgis_argument(obj, qgis_argument_spec(qgis_type = "point")),
248+
"^[\\de\\+]+,[\\de\\+]+(?:\\[\\w+:\\d+\\])?$",
249+
perl = TRUE
250+
)
251+
} else {
252+
expect_match(
253+
as_qgis_argument(obj, qgis_argument_spec(qgis_type = "point")),
254+
"^[\\de\\+]+,[\\de\\+]+\\[\\w+:\\d+\\]$",
255+
perl = TRUE
256+
)
257+
}
250258
})
251259

252260
test_that("terra argument coercers work for a SpatVectorProxy referring to a layer in a multi-layer file", {

0 commit comments

Comments
 (0)