Skip to content

Commit d23020d

Browse files
committed
Fix snapshot tests across platforms
1 parent 2cd8c25 commit d23020d

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

tests/testthat/_snaps/path.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
path(paste(rep("a", 1e+05), collapse = ""))
55
Condition
66
Error in `path_tidy()`:
7-
! Total path length must be less than PATH_MAX: 1024
7+
! Total path length must be less than PATH_MAX: <path-max>
88
Code
99
do.call(path, as.list(rep("a", 1e+05)))
1010
Condition
1111
Error in `path_tidy()`:
12-
! Total path length must be less than PATH_MAX: 1024
12+
! Total path length must be less than PATH_MAX: <path-max>
1313

1414
# path_rel: works for POSIX paths
1515

tests/testthat/helper.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,7 @@ named_fs_path <- function(x) {
3737
transform_error <- function(x) {
3838
sub("Error in `.*[(][)]`:", "Error:", x)
3939
}
40+
41+
transform_path_max <- function(x) {
42+
sub("PATH_MAX: [0-9]+", "PATH_MAX: <path-max>", x)
43+
}

tests/testthat/test-path.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ describe("path", {
5252
expect_snapshot(error = TRUE, {
5353
path(paste(rep("a", 100000), collapse = ""))
5454
do.call(path, as.list(rep("a", 100000)))
55-
})
55+
}, transform = transform_path_max)
5656
})
5757

5858
it("follows recycling rules", {

0 commit comments

Comments
 (0)