From da1febff1eb29172f8f464360d0358ef66414488 Mon Sep 17 00:00:00 2001 From: memoryleak47 Date: Fri, 23 Mar 2018 15:31:05 +0100 Subject: [PATCH] the expected ui output is now the empty String if the corresponding files are missing --- src/tools/compiletest/src/runtest.rs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 540ff13eae55..320bca7bb647 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -2802,7 +2802,7 @@ impl<'test> TestCx<'test> { normalized } - fn expected_output_path(&self, kind: &str) -> Result { + fn load_expected_output(&self, kind: &str) -> String { let mut path = expected_output_path(&self.testpaths, self.revision, &self.config.compare_mode, @@ -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 { let mut result = String::new(); match File::open(path).and_then(|mut f| f.read_to_string(&mut result)) {