Skip to content

Commit 9b6f028

Browse files
committed
Uses Windows paths
1 parent 08752d0 commit 9b6f028

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

src/lib_tests.rs

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,29 @@ mod tests {
8989
init_pnp_manifest(manifest, &PathBuf::from("/path/to/project/.pnp.cjs"));
9090

9191
for test in test_suite.tests.iter() {
92-
let specifier = &test.imported;
93-
let parent = &PathBuf::from(&test.importer).join("fooo");
92+
let specifier
93+
= &test.imported;
9494

95-
let manifest_copy = manifest.clone();
95+
let mut importer
96+
= test.importer.clone();
97+
98+
#[cfg(windows)] {
99+
importer.replace_range(0..1, "C:\\");
100+
importer.replace("/", "\\");
101+
}
102+
103+
let mut expected = test.expected.clone();
104+
105+
#[cfg(windows)] {
106+
importer.replace_range(0..1, "C:\\");
107+
importer.replace("/", "\\");
108+
}
109+
110+
let parent
111+
= &PathBuf::from(&importer).join("my-file");
112+
113+
let manifest_copy
114+
= manifest.clone();
96115

97116
let host = ResolutionHost {
98117
find_pnp_manifest: Box::new(move |_| Ok(Some(manifest_copy.clone()))),
@@ -104,11 +123,12 @@ mod tests {
104123
..Default::default()
105124
};
106125

107-
let resolution = resolve_to_unqualified(specifier, parent, &config);
126+
let resolution
127+
= resolve_to_unqualified(specifier, parent, &config);
108128

109129
match resolution {
110130
Ok(Resolution::Resolved(path, _subpath)) => {
111-
assert_eq!(path.to_string_lossy(), test.expected, "{}", test.it);
131+
assert_eq!(path.to_string_lossy(), expected, "{}", test.it);
112132
}
113133
Ok(Resolution::Skipped) => {
114134
assert_eq!(specifier, &test.expected, "{}", test.it);

0 commit comments

Comments
 (0)