Skip to content

Commit bddb685

Browse files
committed
Use assert_eq! instead of assert! in tests
1 parent a9f1e29 commit bddb685

File tree

150 files changed

+396
-383
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

150 files changed

+396
-383
lines changed

src/test/auxiliary/extern_calling_convention.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
#[inline(never)]
1515
#[cfg(target_arch = "x86_64")]
1616
pub extern "win64" fn foo(a: isize, b: isize, c: isize, d: isize) {
17-
assert!(a == 1);
18-
assert!(b == 2);
19-
assert!(c == 3);
20-
assert!(d == 4);
17+
assert_eq!(a, 1);
18+
assert_eq!(b, 2);
19+
assert_eq!(c, 3);
20+
assert_eq!(d, 4);
2121

2222
println!("a: {}, b: {}, c: {}, d: {}",
2323
a, b, c, d)
@@ -26,10 +26,10 @@ pub extern "win64" fn foo(a: isize, b: isize, c: isize, d: isize) {
2626
#[inline(never)]
2727
#[cfg(any(target_arch = "x86", target_arch = "arm", target_arch = "aarch64"))]
2828
pub extern fn foo(a: isize, b: isize, c: isize, d: isize) {
29-
assert!(a == 1);
30-
assert!(b == 2);
31-
assert!(c == 3);
32-
assert!(d == 4);
29+
assert_eq!(a, 1);
30+
assert_eq!(b, 2);
31+
assert_eq!(c, 3);
32+
assert_eq!(d, 4);
3333

3434
println!("a: {}, b: {}, c: {}, d: {}",
3535
a, b, c, d)

src/test/bench/shootout-mandelbrot.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const LIMIT: f64 = 2.0;
5454
const WORKERS: usize = 16;
5555

5656
fn mandelbrot<W: Write>(w: usize, mut out: W) -> io::Result<()> {
57-
assert!(WORKERS % 2 == 0);
57+
assert_eq!(WORKERS % 2, 0);
5858

5959
// Ensure w and h are multiples of 8.
6060
let w = (w + 7) / 8 * 8;
@@ -76,7 +76,7 @@ fn mandelbrot<W: Write>(w: usize, mut out: W) -> io::Result<()> {
7676
let v_consts = f64x2(1.5, 1.0);
7777

7878
// A lot of this code assumes this (so do other lang benchmarks)
79-
assert!(w == h);
79+
assert_eq!(w, h);
8080
let mut precalc_r = Vec::with_capacity(w);
8181
let mut precalc_i = Vec::with_capacity(h);
8282

src/test/compile-fail/builtin-superkinds-self-type.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ impl <T: Sync> Foo for T { }
2323
fn main() {
2424
let (tx, rx) = channel();
2525
1193182.foo(tx);
26-
assert!(rx.recv() == 1193182);
26+
assert_eq!(rx.recv(), 1193182);
2727
}

src/test/compile-fail/match-static-const-lc.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ fn f() {
2222
//~^ ERROR constant in pattern `a` should have an upper case name such as `A`
2323
(x, y) => 1 + x + y,
2424
};
25-
assert!(r == 1);
25+
assert_eq!(r, 1);
2626
}
2727

2828
mod m {
@@ -37,7 +37,7 @@ fn g() {
3737
//~^ ERROR constant in pattern `aha` should have an upper case name such as `AHA`
3838
(x, y) => 1 + x + y,
3939
};
40-
assert!(r == 1);
40+
assert_eq!(r, 1);
4141
}
4242

4343
mod n {
@@ -51,7 +51,7 @@ fn h() {
5151
//~^ ERROR constant in pattern `not_okay` should have an upper case name such as `NOT_OKAY`
5252
(x, y) => 1 + x + y,
5353
};
54-
assert!(r == 1);
54+
assert_eq!(r, 1);
5555
}
5656

5757
fn main () {

src/test/compile-fail/mod_file_correct_spans.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
mod mod_file_aux;
1414

1515
fn main() {
16-
assert!(mod_file_aux::bar() == 10); //~ ERROR unresolved name
16+
assert_eq!(mod_file_aux::bar(), 10); //~ ERROR unresolved name
1717
}

src/test/compile-fail/private-struct-field-cross-crate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ use cci_class::kitties::cat;
1414

1515
fn main() {
1616
let nyan : cat = cat(52, 99);
17-
assert!((nyan.meows == 52));
17+
assert_eq!(nyan.meows, 52);
1818
//~^ ERROR field `meows` of struct `cci_class::kitties::cat` is private
1919
}

src/test/compile-fail/private-struct-field.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ mod cat {
2020

2121
fn main() {
2222
let nyan = cat::new_cat();
23-
assert!(nyan.meows == 52); //~ ERROR field `meows` of struct `cat::Cat` is private
23+
assert_eq!(nyan.meows, 52); //~ ERROR field `meows` of struct `cat::Cat` is private
2424
}

src/test/compile-fail/syntax-extension-minor.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,5 @@ pub fn main() {
1717
assert_eq!(concat_idents!(asd, f_f, dsa), "<.<".to_string());
1818
//~^ ERROR: unresolved name `asdf_fdsa`
1919

20-
assert!(stringify!(use_mention_distinction) ==
21-
"use_mention_distinction");
20+
assert_eq!(stringify!(use_mention_distinction), "use_mention_distinction");
2221
}

src/test/parse-fail/macros-no-semicolon.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// compile-flags: -Z parse-only
1212

1313
fn main() {
14-
assert!(1 == 2)
15-
assert!(3 == 4) //~ ERROR expected one of `.`, `;`, `}`, or an operator, found `assert`
14+
assert_eq!(1, 2)
15+
assert_eq!(3, 4) //~ ERROR expected one of `.`, `;`, `}`, or an operator, found `assert_eq`
1616
println!("hello");
1717
}

src/test/pretty/do1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212

1313
fn f<F>(f: F) where F: Fn(isize) { f(10) }
1414

15-
fn main() { f(|i| { assert!(i == 10) }) }
15+
fn main() { f(|i| { assert_eq!(i , 10) }) }

0 commit comments

Comments
 (0)