summaryrefslogtreecommitdiffstats
path: root/src/bootstrap/config/tests.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
commit218caa410aa38c29984be31a5229b9fa717560ee (patch)
treec54bd55eeb6e4c508940a30e94c0032fbd45d677 /src/bootstrap/config/tests.rs
parentReleasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz
rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/bootstrap/config/tests.rs')
-rw-r--r--src/bootstrap/config/tests.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/bootstrap/config/tests.rs b/src/bootstrap/config/tests.rs
new file mode 100644
index 000000000..c30c91317
--- /dev/null
+++ b/src/bootstrap/config/tests.rs
@@ -0,0 +1,24 @@
+use super::{Config, TomlConfig};
+use std::path::Path;
+
+fn toml(config: &str) -> impl '_ + Fn(&Path) -> TomlConfig {
+ |&_| toml::from_str(config).unwrap()
+}
+
+fn parse(config: &str) -> Config {
+ Config::parse_inner(&["check".to_owned(), "--config=/does/not/exist".to_owned()], toml(config))
+}
+
+#[test]
+fn download_ci_llvm() {
+ let parse_llvm = |s| parse(s).llvm_from_ci;
+ let if_available = parse_llvm("llvm.download-ci-llvm = \"if-available\"");
+
+ assert!(parse_llvm("llvm.download-ci-llvm = true"));
+ assert!(!parse_llvm("llvm.download-ci-llvm = false"));
+ assert_eq!(parse_llvm(""), if_available);
+ assert_eq!(parse_llvm("rust.channel = \"dev\""), if_available);
+ assert!(!parse_llvm("rust.channel = \"stable\""));
+}
+
+// FIXME: add test for detecting `src` and `out`