Skip to content

Commit

Permalink
test: verify how build-std flag be deserialized now
Browse files Browse the repository at this point in the history
It doesn't parse as comma-separated list.
It did before rust-lang#14899
  • Loading branch information
weihanglo committed Jan 14, 2025
1 parent 54df3c7 commit b981672
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions tests/testsuite/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2163,3 +2163,65 @@ gitoxide = \"fetch\"
unstable_flags.gitoxide == expect
}
}

#[cargo_test]
fn build_std() {
let gctx = GlobalContextBuilder::new()
.env("CARGO_UNSTABLE_BUILD_STD", "core,std,panic_abort")
.build();
let value = gctx
.get::<Option<cargo::core::CliUnstable>>("unstable")
.unwrap()
.unwrap()
.build_std
.unwrap();
assert_eq!(value, vec!["core,std,panic_abort".to_string()]);

let gctx = GlobalContextBuilder::new()
.config_arg("unstable.build-std=['core', 'std,panic_abort']")
.build();
let value = gctx
.get::<Option<cargo::core::CliUnstable>>("unstable")
.unwrap()
.unwrap()
.build_std
.unwrap();
assert_eq!(
value,
vec!["core".to_string(), "std,panic_abort".to_string()]
);

let gctx = GlobalContextBuilder::new()
.env(
"CARGO_UNSTABLE_BUILD_STD_FEATURES",
"backtrace,panic-unwind,windows_raw_dylib",
)
.build();
let value = gctx
.get::<Option<cargo::core::CliUnstable>>("unstable")
.unwrap()
.unwrap()
.build_std_features
.unwrap();
assert_eq!(
value,
vec!["backtrace,panic-unwind,windows_raw_dylib".to_string()]
);

let gctx = GlobalContextBuilder::new()
.config_arg("unstable.build-std-features=['backtrace', 'panic-unwind,windows_raw_dylib']")
.build();
let value = gctx
.get::<Option<cargo::core::CliUnstable>>("unstable")
.unwrap()
.unwrap()
.build_std_features
.unwrap();
assert_eq!(
value,
vec![
"backtrace".to_string(),
"panic-unwind,windows_raw_dylib".to_string()
]
);
}

0 comments on commit b981672

Please sign in to comment.