Correctly report the checks count
It might be slightly cleaner and more extensible to change to return a summary, potentially even making track the tests, coverage, etc. so it can be serialized to JSON. But, for now, this is much simpler, and the approach that KtorZ suggested.
This commit is contained in:
parent
e944f10372
commit
ace58e368c
|
@ -89,6 +89,7 @@ where
|
||||||
root: PathBuf,
|
root: PathBuf,
|
||||||
sources: Vec<Source>,
|
sources: Vec<Source>,
|
||||||
warnings: Vec<Warning>,
|
warnings: Vec<Warning>,
|
||||||
|
checks_count: Option<usize>,
|
||||||
event_listener: T,
|
event_listener: T,
|
||||||
functions: IndexMap<FunctionAccessKey, TypedFunction>,
|
functions: IndexMap<FunctionAccessKey, TypedFunction>,
|
||||||
data_types: IndexMap<DataTypeKey, TypedDataType>,
|
data_types: IndexMap<DataTypeKey, TypedDataType>,
|
||||||
|
@ -128,6 +129,7 @@ where
|
||||||
root,
|
root,
|
||||||
sources: vec![],
|
sources: vec![],
|
||||||
warnings: vec![],
|
warnings: vec![],
|
||||||
|
checks_count: None,
|
||||||
event_listener,
|
event_listener,
|
||||||
functions,
|
functions,
|
||||||
data_types,
|
data_types,
|
||||||
|
@ -336,6 +338,15 @@ where
|
||||||
|
|
||||||
let tests = self.run_tests(tests, seed);
|
let tests = self.run_tests(tests, seed);
|
||||||
|
|
||||||
|
self.checks_count = if tests.is_empty() { None } else {
|
||||||
|
Some(tests.iter().fold(0, |acc, test| {
|
||||||
|
acc + match test {
|
||||||
|
TestResult::PropertyTestResult(r) => r.iterations,
|
||||||
|
_ => 1,
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
let errors: Vec<Error> = tests
|
let errors: Vec<Error> = tests
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|e| {
|
.filter_map(|e| {
|
||||||
|
|
|
@ -120,7 +120,7 @@ where
|
||||||
eprintln!(
|
eprintln!(
|
||||||
"{}",
|
"{}",
|
||||||
Summary {
|
Summary {
|
||||||
check_count: None,
|
check_count: project.checks_count,
|
||||||
warning_count,
|
warning_count,
|
||||||
error_count: errs.len(),
|
error_count: errs.len(),
|
||||||
}
|
}
|
||||||
|
@ -132,7 +132,7 @@ where
|
||||||
eprintln!(
|
eprintln!(
|
||||||
"{}",
|
"{}",
|
||||||
Summary {
|
Summary {
|
||||||
check_count: Some(41),
|
check_count: project.checks_count,
|
||||||
error_count: 0,
|
error_count: 0,
|
||||||
warning_count
|
warning_count
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue