From 59a07added0e890706a32cdb69680b9a7cd004a0 Mon Sep 17 00:00:00 2001 From: Colin Finck Date: Wed, 8 Jan 2025 15:53:06 +0100 Subject: [PATCH] Add a test for `--remap-path-prefix` --- src/compiler/rust.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/compiler/rust.rs b/src/compiler/rust.rs index f808d7f94..771896ff1 100644 --- a/src/compiler/rust.rs +++ b/src/compiler/rust.rs @@ -3798,6 +3798,34 @@ proc_macro false assert_eq!(h.gcno, Some("foo-a1b6419f8321841f.gcno".into())); } + #[test] + fn test_parse_remap_path_prefix() { + let h = parses!( + "--crate-name", + "foo", + "--crate-type", + "lib", + "./src/lib.rs", + "--emit=dep-info,link", + "--out-dir", + "/out", + "--remap-path-prefix", + "/home/test=~", + "--remap-path-prefix", + "/root=~" + ); + assert!(h.arguments.contains(&Argument::WithValue( + "--remap-path-prefix", + ArgData::PassThrough(OsString::from("/home/test=~")), + ArgDisposition::Separated + ))); + assert!(h.arguments.contains(&Argument::WithValue( + "--remap-path-prefix", + ArgData::PassThrough(OsString::from("/root=~")), + ArgDisposition::Separated + ))); + } + #[test] fn test_parse_target() { // Parse a --target argument that is a string (not a path to a .json file).