add coverage for explicit stage fields
Signed-off-by: onur-ozkan <work@onurozkan.dev>
This commit is contained in:
parent
37b18f8f47
commit
cf6dc742b7
1 changed files with 57 additions and 0 deletions
|
|
@ -454,3 +454,60 @@ fn check_rustc_if_unchanged_paths() {
|
|||
assert!(config.src.join(p).exists(), "{p} doesn't exist.");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_explicit_stage() {
|
||||
let config = Config::parse_inner(
|
||||
Flags::parse(&["check".to_owned(), "--config=/does/not/exist".to_owned()]),
|
||||
|&_| {
|
||||
toml::from_str(
|
||||
r#"
|
||||
[build]
|
||||
test-stage = 1
|
||||
"#,
|
||||
)
|
||||
},
|
||||
);
|
||||
|
||||
assert!(!config.explicit_stage_from_cli);
|
||||
assert!(config.explicit_stage_from_config);
|
||||
|
||||
let config = Config::parse_inner(
|
||||
Flags::parse(&[
|
||||
"check".to_owned(),
|
||||
"--stage=2".to_owned(),
|
||||
"--config=/does/not/exist".to_owned(),
|
||||
]),
|
||||
|&_| toml::from_str(""),
|
||||
);
|
||||
|
||||
assert!(config.explicit_stage_from_cli);
|
||||
assert!(!config.explicit_stage_from_config);
|
||||
|
||||
let config = Config::parse_inner(
|
||||
Flags::parse(&[
|
||||
"check".to_owned(),
|
||||
"--stage=2".to_owned(),
|
||||
"--config=/does/not/exist".to_owned(),
|
||||
]),
|
||||
|&_| {
|
||||
toml::from_str(
|
||||
r#"
|
||||
[build]
|
||||
test-stage = 1
|
||||
"#,
|
||||
)
|
||||
},
|
||||
);
|
||||
|
||||
assert!(config.explicit_stage_from_cli);
|
||||
assert!(config.explicit_stage_from_config);
|
||||
|
||||
let config = Config::parse_inner(
|
||||
Flags::parse(&["check".to_owned(), "--config=/does/not/exist".to_owned()]),
|
||||
|&_| toml::from_str(""),
|
||||
);
|
||||
|
||||
assert!(!config.explicit_stage_from_cli);
|
||||
assert!(!config.explicit_stage_from_config);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue