diff --git a/tests/testsuite/config.rs b/tests/testsuite/config.rs index ddaa168eb97..a99e5c81307 100644 --- a/tests/testsuite/config.rs +++ b/tests/testsuite/config.rs @@ -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::>("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::>("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::>("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::>("unstable") + .unwrap() + .unwrap() + .build_std_features + .unwrap(); + assert_eq!( + value, + vec![ + "backtrace".to_string(), + "panic-unwind,windows_raw_dylib".to_string() + ] + ); +}