From 86d48981eedd4ae21886c43fdfd2565a6bc34d21 Mon Sep 17 00:00:00 2001 From: Andy Russell Date: Wed, 12 Jul 2017 13:21:36 -0400 Subject: [PATCH] assert no errors on formatting test source Fixes #28. --- tests/system.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tests/system.rs b/tests/system.rs index b43bb081921..b22a22afd69 100644 --- a/tests/system.rs +++ b/tests/system.rs @@ -35,8 +35,6 @@ fn get_path_string(dir_entry: io::Result) -> String { // to their equivalent in tests/target. The target file and config can be // overridden by annotations in the source file. The input and output must match // exactly. -// FIXME(#28) would be good to check for error messages and fail on them, or at -// least report. #[test] fn system_tests() { // Get all files in the tests/source directory. @@ -240,10 +238,17 @@ fn read_config(filename: &str) -> Config { config } -fn format_file>(filename: P, config: &Config) -> (FileMap, FormatReport) { - let input = Input::File(filename.into()); - let (_error_summary, file_map, report) = +fn format_file>(filepath: P, config: &Config) -> (FileMap, FormatReport) { + let filepath = filepath.into(); + let display_path = filepath.display().to_string(); + let input = Input::File(filepath); + let (error_summary, file_map, report) = format_input::(input, &config, None).unwrap(); + assert!( + error_summary.has_no_errors(), + "Encountered errors formatting {}", + display_path + ); return (file_map, report); }