Skip to content

Commit e8cccc4

Browse files
committed
test: fix resolve_symlink
1 parent 6b8a696 commit e8cccc4

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

src/app/deduplicate_arguments.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,17 @@ mod tests {
144144
"absolute_path should be absolute: {absolute_path:?}",
145145
);
146146
for &(link_path, link_target) in MOCKED_SYMLINKS {
147-
if let Ok(suffix) = absolute_path.strip_prefix(link_path) {
148-
return link_target
149-
.pipe(PathBuf::from)
147+
let link_path = PathBuf::from(link_path);
148+
assert!(
149+
link_path.is_absolute(),
150+
"link_path should be absolute: {link_path:?}",
151+
);
152+
let Some(parent) = link_path.parent() else {
153+
panic!("Cannot get parent of {link_path:?}");
154+
};
155+
if let Ok(suffix) = absolute_path.strip_prefix(&link_path) {
156+
return parent
157+
.join(link_target)
150158
.join(suffix)
151159
.normalize()
152160
.pipe(resolve_symlink);

0 commit comments

Comments
 (0)