]> git.proxmox.com Git - rustc.git/blob - src/bootstrap/config/tests.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / src / bootstrap / config / tests.rs
1 use super::{Config, TomlConfig};
2 use std::path::Path;
3
4 fn toml(config: &str) -> impl '_ + Fn(&Path) -> TomlConfig {
5 |&_| toml::from_str(config).unwrap()
6 }
7
8 fn parse(config: &str) -> Config {
9 Config::parse_inner(&["check".to_owned(), "--config=/does/not/exist".to_owned()], toml(config))
10 }
11
12 #[test]
13 fn download_ci_llvm() {
14 let parse_llvm = |s| parse(s).llvm_from_ci;
15 let if_available = parse_llvm("llvm.download-ci-llvm = \"if-available\"");
16
17 assert!(parse_llvm("llvm.download-ci-llvm = true"));
18 assert!(!parse_llvm("llvm.download-ci-llvm = false"));
19 assert_eq!(parse_llvm(""), if_available);
20 assert_eq!(parse_llvm("rust.channel = \"dev\""), if_available);
21 assert!(!parse_llvm("rust.channel = \"stable\""));
22 }
23
24 // FIXME: add test for detecting `src` and `out`