Skip to content

Commit ffe841c

Browse files
weihangloehuss
authored andcommitted
test: verify how build-std flag be deserialized now
It doesn't parse as comma-separated list. It did before #14899
1 parent ac22fd3 commit ffe841c

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

tests/testsuite/config.rs

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2163,3 +2163,65 @@ gitoxide = \"fetch\"
21632163
unstable_flags.gitoxide == expect
21642164
}
21652165
}
2166+
2167+
#[cargo_test]
2168+
fn build_std() {
2169+
let gctx = GlobalContextBuilder::new()
2170+
.env("CARGO_UNSTABLE_BUILD_STD", "core,std,panic_abort")
2171+
.build();
2172+
let value = gctx
2173+
.get::<Option<cargo::core::CliUnstable>>("unstable")
2174+
.unwrap()
2175+
.unwrap()
2176+
.build_std
2177+
.unwrap();
2178+
assert_eq!(value, vec!["core,std,panic_abort".to_string()]);
2179+
2180+
let gctx = GlobalContextBuilder::new()
2181+
.config_arg("unstable.build-std=['core', 'std,panic_abort']")
2182+
.build();
2183+
let value = gctx
2184+
.get::<Option<cargo::core::CliUnstable>>("unstable")
2185+
.unwrap()
2186+
.unwrap()
2187+
.build_std
2188+
.unwrap();
2189+
assert_eq!(
2190+
value,
2191+
vec!["core".to_string(), "std,panic_abort".to_string()]
2192+
);
2193+
2194+
let gctx = GlobalContextBuilder::new()
2195+
.env(
2196+
"CARGO_UNSTABLE_BUILD_STD_FEATURES",
2197+
"backtrace,panic-unwind,windows_raw_dylib",
2198+
)
2199+
.build();
2200+
let value = gctx
2201+
.get::<Option<cargo::core::CliUnstable>>("unstable")
2202+
.unwrap()
2203+
.unwrap()
2204+
.build_std_features
2205+
.unwrap();
2206+
assert_eq!(
2207+
value,
2208+
vec!["backtrace,panic-unwind,windows_raw_dylib".to_string()]
2209+
);
2210+
2211+
let gctx = GlobalContextBuilder::new()
2212+
.config_arg("unstable.build-std-features=['backtrace', 'panic-unwind,windows_raw_dylib']")
2213+
.build();
2214+
let value = gctx
2215+
.get::<Option<cargo::core::CliUnstable>>("unstable")
2216+
.unwrap()
2217+
.unwrap()
2218+
.build_std_features
2219+
.unwrap();
2220+
assert_eq!(
2221+
value,
2222+
vec![
2223+
"backtrace".to_string(),
2224+
"panic-unwind,windows_raw_dylib".to_string()
2225+
]
2226+
);
2227+
}

0 commit comments

Comments
 (0)