Skip to content

Improve test output #65377

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/liballoc/benches/linked_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,30 +48,30 @@ fn bench_iter(b: &mut Bencher) {
let v = &[0; 128];
let m: LinkedList<_> = v.iter().cloned().collect();
b.iter(|| {
assert!(m.iter().count() == 128);
assert_eq!(m.iter().count(), 128);
})
}
#[bench]
fn bench_iter_mut(b: &mut Bencher) {
let v = &[0; 128];
let mut m: LinkedList<_> = v.iter().cloned().collect();
b.iter(|| {
assert!(m.iter_mut().count() == 128);
assert_eq!(m.iter_mut().count(), 128);
})
}
#[bench]
fn bench_iter_rev(b: &mut Bencher) {
let v = &[0; 128];
let m: LinkedList<_> = v.iter().cloned().collect();
b.iter(|| {
assert!(m.iter().rev().count() == 128);
assert_eq!(m.iter().rev().count(), 128);
})
}
#[bench]
fn bench_iter_mut_rev(b: &mut Bencher) {
let v = &[0; 128];
let mut m: LinkedList<_> = v.iter().cloned().collect();
b.iter(|| {
assert!(m.iter_mut().rev().count() == 128);
assert_eq!(m.iter_mut().rev().count(), 128);
})
}
2 changes: 1 addition & 1 deletion src/liballoc/benches/vec_deque_append.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fn main() {
let l = durations.len();
durations.sort();

assert!(BENCH_N % 2 == 0);
assert_eq!(BENCH_N % 2, 0);
let median = (durations[(l / 2) - 1] + durations[l / 2]) / 2;
println!(
"\ncustom-bench vec_deque_append {:?} ns/iter\n",
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_codegen_ssa/back/rpath/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ fn test_minimize1() {
"rpath2".to_string(),
"rpath1".to_string()
]);
assert!(res == [
assert_eq!(res, [
"rpath1",
"rpath2",
]);
Expand All @@ -40,7 +40,7 @@ fn test_minimize2() {
"4a".to_string(),
"3".to_string()
]);
assert!(res == [
assert_eq!(res, [
"1a",
"2",
"4a",
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/sys_common/bytestring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ mod tests {
let expected = r#""\xF0hello,\tworld""#;
let output = format!("{:?}", Helper(input));

assert!(output == expected);
assert_eq!(output, expected);
}
}
14 changes: 7 additions & 7 deletions src/libtest/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ pub fn do_not_run_ignored_tests() {
let (tx, rx) = channel();
run_test(&TestOpts::new(), false, desc, RunStrategy::InProcess, tx, Concurrent::No);
let (_, res, _, _) = rx.recv().unwrap();
assert!(res != TrOk);
assert_ne!(res, TrOk);
}

#[test]
Expand All @@ -92,7 +92,7 @@ pub fn ignored_tests_result_in_ignored() {
let (tx, rx) = channel();
run_test(&TestOpts::new(), false, desc, RunStrategy::InProcess, tx, Concurrent::No);
let (_, res, _, _) = rx.recv().unwrap();
assert!(res == TrIgnored);
assert_eq!(res, TrIgnored);
}

#[test]
Expand All @@ -113,7 +113,7 @@ fn test_should_panic() {
let (tx, rx) = channel();
run_test(&TestOpts::new(), false, desc, RunStrategy::InProcess, tx, Concurrent::No);
let (_, res, _, _) = rx.recv().unwrap();
assert!(res == TrOk);
assert_eq!(res, TrOk);
}

#[test]
Expand All @@ -134,7 +134,7 @@ fn test_should_panic_good_message() {
let (tx, rx) = channel();
run_test(&TestOpts::new(), false, desc, RunStrategy::InProcess, tx, Concurrent::No);
let (_, res, _, _) = rx.recv().unwrap();
assert!(res == TrOk);
assert_eq!(res, TrOk);
}

#[test]
Expand All @@ -157,7 +157,7 @@ fn test_should_panic_bad_message() {
let (tx, rx) = channel();
run_test(&TestOpts::new(), false, desc, RunStrategy::InProcess, tx, Concurrent::No);
let (_, res, _, _) = rx.recv().unwrap();
assert!(res == TrFailedMsg(format!("{} '{}'", failed_msg, expected)));
assert_eq!(res, TrFailedMsg(format!("{} '{}'", failed_msg, expected)));
}

#[test]
Expand All @@ -176,7 +176,7 @@ fn test_should_panic_but_succeeds() {
let (tx, rx) = channel();
run_test(&TestOpts::new(), false, desc, RunStrategy::InProcess, tx, Concurrent::No);
let (_, res, _, _) = rx.recv().unwrap();
assert!(res == TrFailedMsg("test did not panic as expected".to_string()));
assert_eq!(res, TrFailedMsg("test did not panic as expected".to_string()));
}

fn report_time_test_template(report_time: bool) -> Option<TestExecTime> {
Expand Down Expand Up @@ -550,7 +550,7 @@ pub fn sort_tests() {
];

for (a, b) in expected.iter().zip(filtered) {
assert!(*a == b.desc.name.to_string());
assert_eq!(*a, b.desc.name.to_string());
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/run-fail/panic.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// error-pattern:1 == 2
fn main() {
assert!(1 == 2);
assert_eq!(1, 2);
}
2 changes: 1 addition & 1 deletion src/test/ui/issues/issue-5927.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ fn main() {
x(1) => x(1) //~ ERROR cannot find tuple struct/variant `x` in this scope
//~^ ERROR cannot find function `x` in this scope
};
assert!(z == 3);
assert_eq!(z, 3);
}
2 changes: 1 addition & 1 deletion src/test/ui/mod/mod_file_correct_spans.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
mod mod_file_aux;

fn main() {
assert!(mod_file_aux::bar() == 10);
assert_eq!(mod_file_aux::bar(), 10);
//~^ ERROR cannot find function `bar` in module `mod_file_aux`
}