Skip to content

Commit

Permalink
the expected ui output is now the empty String if the corresponding f…
Browse files Browse the repository at this point in the history
…iles are missing
  • Loading branch information
memoryleak47 committed Mar 23, 2018
1 parent bb7ab5c commit da1febf
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/tools/compiletest/src/runtest.rs
Expand Up @@ -2802,7 +2802,7 @@ impl<'test> TestCx<'test> {
normalized
}

fn expected_output_path(&self, kind: &str) -> Result<PathBuf, String> {
fn load_expected_output(&self, kind: &str) -> String {
let mut path = expected_output_path(&self.testpaths,
self.revision,
&self.config.compare_mode,
Expand All @@ -2814,18 +2814,15 @@ impl<'test> TestCx<'test> {
}

if path.exists() {
Ok(path)
match self.load_expected_output_from_path(&path) {
Ok(x) => x,
Err(x) => self.fatal(&x),
}
} else {
Err(String::from("no existing output_path found"))
String::new()
}
}

fn load_expected_output(&self, kind: &str) -> String {
self.expected_output_path(kind)
.and_then(|x| self.load_expected_output_from_path(&x))
.unwrap_or_else(|x| self.fatal(&x))
}

fn load_expected_output_from_path(&self, path: &Path) -> Result<String, String> {
let mut result = String::new();
match File::open(path).and_then(|mut f| f.read_to_string(&mut result)) {
Expand Down

0 comments on commit da1febf

Please sign in to comment.