mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-30 18:53:39 +00:00
Fix overriding license header bug (#4488)
* Override header to None when path len = 0 * Add regression test * Ensure nightly
This commit is contained in:
parent
6a7824787e
commit
fa9d97499e
@ -299,6 +299,8 @@ macro_rules! create_config {
|
||||
Err(msg) => eprintln!("Warning for license template file {:?}: {}",
|
||||
lt_path, msg),
|
||||
}
|
||||
} else {
|
||||
self.license_template = None;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -491,6 +491,18 @@ mod test {
|
||||
assert!(config.license_template.is_some());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_override_existing_license_with_no_license() {
|
||||
if !crate::is_nightly_channel!() {
|
||||
return;
|
||||
}
|
||||
let toml = r#"license_template_path = "tests/license-template/lt.txt""#;
|
||||
let mut config = Config::from_toml(toml, Path::new("")).unwrap();
|
||||
assert!(config.license_template.is_some());
|
||||
config.override_value("license_template_path", "");
|
||||
assert!(config.license_template.is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_dump_default_config() {
|
||||
let default_config = format!(
|
||||
|
Loading…
Reference in New Issue
Block a user