Skip to content

Commit a263498

Browse files
committed
Let the install snapshots fail on an unrepaired path
The snapshot transforms normalized backslashes out of the diagnostics. That was added to make the tests pass on Windows before the paths install_executable() builds were repaired, and it outlived its reason: with those paths repaired, a backslash reaching one of these messages is the WSL regression itself, and normalizing it away meant no snapshot could ever catch it. Only the fixture directory is still normalized, and only in the value being matched rather than in the message, because withr::local_tempdir() and repair_path() disagree about a duplicated separator.
1 parent 03592e9 commit a263498

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

tests/testthat/test-model-compile.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,6 @@ test_that("a leftover backup doesn't unwind a compile when warnings are errors",
581581
# Separators are normalized first: on Windows the backup path arrives as
582582
# "<dir>\exe-old-1234", since tempfile() joins with a backslash.
583583
transform = function(lines) {
584-
lines <- gsub("\\\\", "/", lines)
585584
for (dir in unique(c(model_dir, repair_path(model_dir)))) {
586585
lines <- gsub(dir, "<dir>", lines, fixed = TRUE)
587586
}

tests/testthat/test-utils.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,10 @@ exe_path_transform <- function(fixture) {
240240
repair_path(fixture$dir),
241241
gsub("\\\\", "/", fixture$dir)
242242
))
243+
# Deliberately not normalizing separators in the message itself:
244+
# install_executable() repairs the paths it builds, so a backslash reaching a
245+
# diagnostic is a regression these snapshots should catch, not hide.
243246
function(lines) {
244-
lines <- gsub("\\\\", "/", lines)
245247
for (dir in dirs) {
246248
lines <- gsub(dir, "<dir>", lines, fixed = TRUE)
247249
}

0 commit comments

Comments
 (0)