Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions crates/socket-patch-core/src/patch/redirect/yarnrc_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -586,16 +586,19 @@ fn global_folder_values_read_like_yarn() {
Vec::<PathBuf>::new()
);
// An escaped expression stays verbatim (`ini` reads `\\` as `\`
// first).
// first). On Windows the leading `\` makes it root-relative: it keeps
// the cwd's drive and replaces the rest, as `path.resolve` does
// (`/w` has no drive, so nothing of it is kept).
let escaped = if cfg!(windows) {
"\\${HOME}/x"
} else {
"/w/\\${HOME}/x"
};
for text in [
"global-folder=\\${HOME}/x\n",
"global-folder=\\\\${HOME}/x\n",
] {
assert_eq!(
npmrc(Host::new(), text),
paths(&["/w/\\${HOME}/x"]),
"{text:?}"
);
assert_eq!(npmrc(Host::new(), text), paths(&[escaped]), "{text:?}");
}
// `ini` ends an unquoted value at a comment and unquotes a quoted one.
assert_eq!(
Expand Down
Loading