]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_feature/src/tests.rs
Auto merge of #85319 - cjgillot:query-simp, r=Mark-Simulacrum
[rust.git] / compiler / rustc_feature / src / tests.rs
1 use super::UnstableFeatures;
2
3 #[test]
4 fn rustc_bootstrap_parsing() {
5     let is_bootstrap = |env, krate| {
6         std::env::set_var("RUSTC_BOOTSTRAP", env);
7         matches!(UnstableFeatures::from_environment(krate), UnstableFeatures::Cheat)
8     };
9     assert!(is_bootstrap("1", None));
10     assert!(is_bootstrap("1", Some("x")));
11     // RUSTC_BOOTSTRAP allows specifying a specific crate
12     assert!(is_bootstrap("x", Some("x")));
13     // RUSTC_BOOTSTRAP allows multiple comma-delimited crates
14     assert!(is_bootstrap("x,y,z", Some("x")));
15     assert!(is_bootstrap("x,y,z", Some("y")));
16     // Crate that aren't specified do not get unstable features
17     assert!(!is_bootstrap("x", Some("a")));
18     assert!(!is_bootstrap("x,y,z", Some("a")));
19     assert!(!is_bootstrap("x,y,z", None));
20
21     // this is technically a breaking change, but there are no stability guarantees for RUSTC_BOOTSTRAP
22     assert!(!is_bootstrap("0", None));
23 }