mirror of
https://github.com/zaphar/ucg.git
synced 2025-07-24 18:39:50 -04:00
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.
This commit is contained in:
parent
263cccc97a
commit
9fdc845e77
16
src/main.rs
16
src/main.rs
@ -138,6 +138,8 @@ fn visit_ucg_files(
|
|||||||
) -> Result<bool, Box<Error>> {
|
) -> Result<bool, Box<Error>> {
|
||||||
let our_path = String::from(path.to_string_lossy());
|
let our_path = String::from(path.to_string_lossy());
|
||||||
let mut result = true;
|
let mut result = true;
|
||||||
|
// TODO(jwall): Report the failing files at the bottom.
|
||||||
|
let mut summary = String::new();
|
||||||
if path.is_dir() {
|
if path.is_dir() {
|
||||||
for entry in try!(std::fs::read_dir(path)) {
|
for entry in try!(std::fs::read_dir(path)) {
|
||||||
let next_item = try!(entry);
|
let next_item = try!(entry);
|
||||||
@ -152,8 +154,11 @@ fn visit_ucg_files(
|
|||||||
if validate && path_as_string.ends_with("_test.ucg") {
|
if validate && path_as_string.ends_with("_test.ucg") {
|
||||||
if !do_validate(&path_as_string, cache.clone()) {
|
if !do_validate(&path_as_string, cache.clone()) {
|
||||||
result = false;
|
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()) {
|
if !do_compile(&path_as_string, cache.clone()) {
|
||||||
result = false;
|
result = false;
|
||||||
}
|
}
|
||||||
@ -163,12 +168,19 @@ fn visit_ucg_files(
|
|||||||
} else if validate && our_path.ends_with("_test.ucg") {
|
} else if validate && our_path.ends_with("_test.ucg") {
|
||||||
if !do_validate(&our_path, cache) {
|
if !do_validate(&our_path, cache) {
|
||||||
result = false;
|
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) {
|
if !do_compile(&our_path, cache) {
|
||||||
result = false;
|
result = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if validate {
|
||||||
|
println!("RESULTS:");
|
||||||
|
println!("{}", summary);
|
||||||
|
}
|
||||||
Ok(result)
|
Ok(result)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user