From 9fdc845e7716b5b021ef6e76572a88749d6e00c0 Mon Sep 17 00:00:00 2001 From: Jeremy Wall Date: Mon, 20 Aug 2018 22:06:52 -0500 Subject: [PATCH] BUGFIX: Properly run only _test.ucg files in validation. * Fix the validate logic for file filtering. * Add a summary of the files run and their pass/fail status. --- src/main.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 877d050..801325f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -138,6 +138,8 @@ fn visit_ucg_files( ) -> Result> { let our_path = String::from(path.to_string_lossy()); let mut result = true; + // TODO(jwall): Report the failing files at the bottom. + let mut summary = String::new(); if path.is_dir() { for entry in try!(std::fs::read_dir(path)) { let next_item = try!(entry); @@ -152,8 +154,11 @@ fn visit_ucg_files( if validate && path_as_string.ends_with("_test.ucg") { if !do_validate(&path_as_string, cache.clone()) { result = false; + summary.push_str(format!("{} - FAIL\n", path_as_string).as_str()) + } else { + summary.push_str(format!("{} - PASS\n", path_as_string).as_str()) } - } else { + } else if !validate { if !do_compile(&path_as_string, cache.clone()) { result = false; } @@ -163,12 +168,19 @@ fn visit_ucg_files( } else if validate && our_path.ends_with("_test.ucg") { if !do_validate(&our_path, cache) { result = false; + summary.push_str(format!("{} - FAIL\n", our_path).as_str()) + } else { + summary.push_str(format!("{} - PASS\n", &our_path).as_str()) } - } else { + } else if !validate { if !do_compile(&our_path, cache) { result = false; } } + if validate { + println!("RESULTS:"); + println!("{}", summary); + } Ok(result) }