Prettier spec testing
@@ -153,21 +153,22 @@ fn run_spec(spec_text: &str, args: &[String], opts: Options) {
let spec = Spec::new(spec_text);
let mut tests_failed = 0;
let mut tests_run = 0;
- let mut line_count = 0;
+ let mut fail_report = String::new();
for test in spec {
if first.map(|fst| test.n < fst).unwrap_or(false) { continue }
if last.map(|lst| test.n > lst).unwrap_or(false) { break }
- if tests_run == 0 || line_count == 0 || (test.n % 10 == 0) {
- if line_count > 30 {
+ if test.n % 10 == 1 {
+ if test.n % 40 == 1 {
+ if test.n > 1 {
println!("");
- line_count = 0;
- } else if line_count > 0 {
+ }
+ } else {
print!(" ");
}
print!("[{:3}]", test.n);
- } else if line_count > 0 && (test.n % 10) == 5 {
+ } else if test.n % 10 == 6 {
print!(" ");
}
@@ -177,20 +178,19 @@ fn run_spec(spec_text: &str, args: &[String], opts: Options) {
print!(".");
} else {
if tests_failed == 0 {
- print!("FAIL {}:\n\n---input---\n{:?}\n\n---wanted---\n{:?}\n\n---got---\n{:?}\n",
+ fail_report = format!("\nFAIL {}:\n\n---input---\n{:?}\n\n---wanted---\n{:?}\n\n---got---\n{:?}\n",
test.n, test.input, test.expected, our_html);
- } else {
- print!("X");
}
+ print!("X");
tests_failed += 1;
}
let _ = io::stdout().flush();
tests_run += 1;
- line_count += 1;
}
- println!("\n{}/{} tests passed", tests_run - tests_failed, tests_run)
+ println!("\n{}/{} tests passed", tests_run - tests_failed, tests_run);
+ print!("{}", fail_report);
}
fn brief<ProgramName>(program: ProgramName) -> String
