Skip to content

Commit e935347

Browse files
authored
Merge pull request #243 from oli-obk/semicolon
Avoid extraneous semicolons
2 parents 96d47dc + 4055b97 commit e935347

File tree

9 files changed

+63
-70
lines changed

9 files changed

+63
-70
lines changed

src/status_emitter.rs

Lines changed: 51 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ impl StatusEmitter for Text {
421421

422422
fn finalize(
423423
&self,
424-
failures: usize,
424+
_failures: usize,
425425
succeeded: usize,
426426
ignored: usize,
427427
filtered: usize,
@@ -436,76 +436,73 @@ impl StatusEmitter for Text {
436436
println!();
437437
}
438438
// Print all errors in a single thread to show reliable output
439-
if failures == 0 {
440-
println!();
441-
print!("test result: {}.", "ok".green());
442-
if succeeded > 0 {
443-
print!(" {} passed;", succeeded.to_string().green());
444-
}
445-
if ignored > 0 {
446-
print!(" {} ignored;", ignored.to_string().yellow());
447-
}
448-
if filtered > 0 {
449-
print!(" {} filtered out;", filtered.to_string().yellow());
450-
}
451-
println!();
452-
println!();
453-
Box::new(())
454-
} else {
455-
struct Summarizer {
456-
failures: Vec<String>,
457-
succeeded: usize,
458-
ignored: usize,
459-
filtered: usize,
460-
}
461-
462-
impl Summary for Summarizer {
463-
fn test_failure(&mut self, status: &dyn TestStatus, errors: &Errors) {
464-
for error in errors {
465-
print_error(error, status.path());
466-
}
439+
struct Summarizer {
440+
failures: Vec<String>,
441+
succeeded: usize,
442+
ignored: usize,
443+
filtered: usize,
444+
}
467445

468-
self.failures.push(if status.revision().is_empty() {
469-
format!(" {}", display(status.path()))
470-
} else {
471-
format!(
472-
" {} (revision {})",
473-
display(status.path()),
474-
status.revision()
475-
)
476-
});
446+
impl Summary for Summarizer {
447+
fn test_failure(&mut self, status: &dyn TestStatus, errors: &Errors) {
448+
for error in errors {
449+
print_error(error, status.path());
477450
}
451+
452+
self.failures.push(if status.revision().is_empty() {
453+
format!(" {}", display(status.path()))
454+
} else {
455+
format!(
456+
" {} (revision {})",
457+
display(status.path()),
458+
status.revision()
459+
)
460+
});
478461
}
462+
}
479463

480-
impl Drop for Summarizer {
481-
fn drop(&mut self) {
464+
impl Drop for Summarizer {
465+
fn drop(&mut self) {
466+
if self.failures.is_empty() {
467+
println!();
468+
print!("test result: {}.", "ok".green());
469+
} else {
482470
println!("{}", "FAILURES:".bright_red().underline().bold());
483471
for line in &self.failures {
484472
println!("{line}");
485473
}
486474
println!();
487475
print!("test result: {}.", "FAIL".bright_red());
488-
print!(" {} failed;", self.failures.len().to_string().green());
489-
if self.succeeded > 0 {
490-
print!(" {} passed;", self.succeeded.to_string().green());
476+
print!(" {} failed", self.failures.len().to_string().green());
477+
if self.succeeded > 0 || self.ignored > 0 || self.filtered > 0 {
478+
print!(";");
491479
}
492-
if self.ignored > 0 {
493-
print!(" {} ignored;", self.ignored.to_string().yellow());
480+
}
481+
if self.succeeded > 0 {
482+
print!(" {} passed", self.succeeded.to_string().green());
483+
if self.ignored > 0 || self.filtered > 0 {
484+
print!(";");
494485
}
486+
}
487+
if self.ignored > 0 {
488+
print!(" {} ignored", self.ignored.to_string().yellow());
495489
if self.filtered > 0 {
496-
print!(" {} filtered out;", self.filtered.to_string().yellow());
490+
print!(";");
497491
}
498-
println!();
499-
println!();
500492
}
493+
if self.filtered > 0 {
494+
print!(" {} filtered out", self.filtered.to_string().yellow());
495+
}
496+
println!();
497+
println!();
501498
}
502-
Box::new(Summarizer {
503-
failures: vec![],
504-
succeeded,
505-
ignored,
506-
filtered,
507-
})
508499
}
500+
Box::new(Summarizer {
501+
failures: vec![],
502+
succeeded,
503+
ignored,
504+
filtered,
505+
})
509506
}
510507
}
511508

tests/integration.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ fn main() -> Result<()> {
66
let path = Path::new(file!()).parent().unwrap();
77
let root_dir = path.join("integrations");
88
let mut config = Config {
9-
bless_command: Some("cargo test".to_string()),
9+
bless_command: Some("cargo test -- -- --bless".to_string()),
1010
..Config::cargo(root_dir.clone())
1111
};
1212

@@ -113,10 +113,6 @@ fn main() -> Result<()> {
113113
.to_str()
114114
.unwrap()
115115
.ends_with("-fail");
116-
if cfg!(windows) && path.components().any(|c| c.as_os_str() == "basic-bin") {
117-
// on windows there's also a .pdb file, so we get additional errors that aren't there on other platforms
118-
return Some(false);
119-
}
120116
if !path.ends_with("Cargo.toml") {
121117
return None;
122118
}

tests/integrations/basic-bin/Cargo.stdout

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; fini
66
Building dependencies ... ok
77
tests/actual_tests/foomp.rs ... ok
88

9-
test result: ok. 1 passed;
9+
test result: ok. 1 passed
1010

tests/integrations/basic-fail-mode/Cargo.stdout

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; fini
1111
Building dependencies ... ok
1212
tests/actual_tests/foomp.rs ... ok
1313

14-
test result: ok. 1 passed;
14+
test result: ok. 1 passed
1515

1616

1717
running 0 tests

tests/integrations/basic-fail/Cargo.stdout

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ FAILURES:
452452
tests/actual_tests/touching_above_below.rs
453453
tests/actual_tests/touching_above_below_chain.rs
454454

455-
test result: FAIL. 15 failed; 1 passed;
455+
test result: FAIL. 15 failed; 1 passed
456456

457457
Building dependencies ... ok
458458
tests/actual_tests_bless/abort.rs (revision `run`) ... FAILED
@@ -1078,7 +1078,7 @@ FAILURES:
10781078
tests/actual_tests_bless/unknown_revision2.rs
10791079
tests/actual_tests_bless/wrong_diagnostic_code.rs
10801080

1081-
test result: FAIL. 23 failed; 24 passed; 3 ignored;
1081+
test result: FAIL. 23 failed; 24 passed; 3 ignored
10821082

10831083
Building dependencies ... ok
10841084
tests/actual_tests_bless_yolo/revisions_bad.rs (revision `foo`) ... ok
@@ -1129,7 +1129,7 @@ full stdout:
11291129
FAILURES:
11301130
tests/actual_tests_bless_yolo/rustfix-multiple-fail.2.fixed
11311131

1132-
test result: FAIL. 1 failed; 7 passed;
1132+
test result: FAIL. 1 failed; 7 passed
11331133

11341134
tests/actual_tests/bad_pattern.rs ... FAILED
11351135
tests/actual_tests/executable.rs ... FAILED
@@ -1475,7 +1475,7 @@ FAILURES:
14751475
tests/actual_tests/touching_above_below.rs
14761476
tests/actual_tests/touching_above_below_chain.rs
14771477

1478-
test result: FAIL. 15 failed;
1478+
test result: FAIL. 15 failed
14791479

14801480
tests/actual_tests/bad_pattern.rs ... FAILED
14811481
tests/actual_tests/executable.rs ... FAILED
@@ -1707,7 +1707,7 @@ FAILURES:
17071707
tests/actual_tests/touching_above_below.rs
17081708
tests/actual_tests/touching_above_below_chain.rs
17091709

1710-
test result: FAIL. 15 failed;
1710+
test result: FAIL. 15 failed
17111711

17121712

17131713
running 0 tests

tests/integrations/basic/Cargo.stdout

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ tests/actual_tests/unicode.rs ... ok
4444
tests/actual_tests/windows_paths.rs ... ok
4545
tests/actual_tests/subdir/aux_proc_macro.rs ... ok
4646

47-
test result: ok. 31 passed;
47+
test result: ok. 31 passed
4848

4949

5050
running 0 tests

tests/integrations/cargo-run/Cargo.stdout

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ tests/actual_tests/matching_stdin.rs ... ok
88
tests/actual_tests/mismatching_stdin.rs ... ok
99
tests/actual_tests/no_stdin.rs ... ok
1010

11-
test result: ok. 4 passed;
11+
test result: ok. 4 passed
1212

tests/integrations/dep-fail/Cargo.stdout

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ BuildFinished { success: false }
3131
FAILURES:
3232
tests/ui/basic_test.rs
3333

34-
test result: FAIL. 1 failed;
34+
test result: FAIL. 1 failed
3535

3636

3737
running 0 tests

tests/integrations/ui_test_dep_bug/Cargo.stdout

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; fini
66
Building dependencies ... ok
77
tests/ui/basic_test.rs ... ok
88

9-
test result: ok. 1 passed;
9+
test result: ok. 1 passed
1010

1111

1212
running 0 tests

0 commit comments

Comments
 (0)