diff options
| author | liushuyu <liushuyu011@gmail.com> | 2023-05-20 17:24:14 -0600 |
|---|---|---|
| committer | liushuyu <liushuyu011@gmail.com> | 2023-05-20 18:33:17 -0600 |
| commit | 343a0bf5c2aebaaa422bd1f92563b606131cb6bd (patch) | |
| tree | 6a0e99fe7a2b340d9cad46b613b5cf63555e7b7e /src/bootstrap/builder | |
| parent | 50e38e928ec4f01018baa83bb101d1c5e3531a83 (diff) | |
| download | rust-343a0bf5c2aebaaa422bd1f92563b606131cb6bd.tar.gz rust-343a0bf5c2aebaaa422bd1f92563b606131cb6bd.zip | |
bootstrap: add test cases for beta revision extraction
Diffstat (limited to 'src/bootstrap/builder')
| -rw-r--r-- | src/bootstrap/builder/tests.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/bootstrap/builder/tests.rs b/src/bootstrap/builder/tests.rs index c32fe59bbf0..edca8fe9b13 100644 --- a/src/bootstrap/builder/tests.rs +++ b/src/bootstrap/builder/tests.rs @@ -146,6 +146,22 @@ fn alias_and_path_for_library() { ); } +#[test] +fn test_beta_rev_parsing() { + use crate::extract_beta_rev; + + // single digit revision + assert_eq!(extract_beta_rev("1.99.9-beta.7 (xxxxxx)"), Some("7".to_string())); + // multiple digits + assert_eq!(extract_beta_rev("1.99.9-beta.777 (xxxxxx)"), Some("777".to_string())); + // nightly channel (no beta revision) + assert_eq!(extract_beta_rev("1.99.9-nightly (xxxxxx)"), None); + // stable channel (no beta revision) + assert_eq!(extract_beta_rev("1.99.9 (xxxxxxx)"), None); + // invalid string + assert_eq!(extract_beta_rev("invalid"), None); +} + mod defaults { use super::{configure, first, run_build}; use crate::builder::*; |
