mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-15 05:26:47 +00:00
Add test case for issue #1111, by adding another route by which a test file's config can be located
This commit is contained in:
parent
69f647b9f1
commit
cb0b7108ca
1
tests/config/issue-1111.toml
Executable file
1
tests/config/issue-1111.toml
Executable file
@ -0,0 +1 @@
|
||||
reorder_imports = true
|
1
tests/source/issue-1111.rs
Normal file
1
tests/source/issue-1111.rs
Normal file
@ -0,0 +1 @@
|
||||
use bar;
|
@ -205,7 +205,11 @@ fn print_mismatches(result: HashMap<String, Vec<Mismatch>>) {
|
||||
|
||||
fn read_config(filename: &str) -> Config {
|
||||
let sig_comments = read_significant_comments(&filename);
|
||||
let mut config = get_config(sig_comments.get("config").map(|x| &(*x)[..]));
|
||||
let mut config = if !sig_comments.is_empty() {
|
||||
get_config(sig_comments.get("config").map(|x| &(*x)[..]))
|
||||
} else {
|
||||
get_config(Path::new(filename).with_extension("toml").file_name().and_then(std::ffi::OsStr::to_str))
|
||||
};
|
||||
|
||||
for (key, val) in &sig_comments {
|
||||
if key != "target" && key != "config" {
|
||||
@ -253,6 +257,9 @@ fn get_config(config_file: Option<&str>) -> Config {
|
||||
Some(file_name) => {
|
||||
let mut full_path = "tests/config/".to_owned();
|
||||
full_path.push_str(&file_name);
|
||||
if !Path::new(&full_path).exists() {
|
||||
return Default::default();
|
||||
};
|
||||
full_path
|
||||
}
|
||||
};
|
||||
|
1
tests/target/issue-1111.rs
Normal file
1
tests/target/issue-1111.rs
Normal file
@ -0,0 +1 @@
|
||||
use bar;
|
Loading…
Reference in New Issue
Block a user