Fix overriding license header bug (#4488)

* Override header to None when path len = 0

* Add regression test

* Ensure nightly
This commit is contained in:
Michael Müller 2020-10-24 18:14:52 +02:00 committed by GitHub
parent 6a7824787e
commit fa9d97499e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

View File

@ -299,6 +299,8 @@ macro_rules! create_config {
Err(msg) => eprintln!("Warning for license template file {:?}: {}",
lt_path, msg),
}
} else {
self.license_template = None;
}
}
}

View File

@ -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!(