about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGiles Cope <gilescope@gmail.com>2017-06-13 14:17:59 +0100
committerGiles Cope <gilescope@gmail.com>2017-06-13 14:31:23 +0100
commit87cfb5431edc2f190d3cde62cef803aaeda63c10 (patch)
tree3fbfe4bd2b77536a679442d03848ba2fb62652b4
parentde8bbd2b164f1839186ce8a5117e86902701bdfe (diff)
Updated tests and fixed inconsistent message on assert_eq
-rw-r--r--src/libcore/macros.rs18
-rw-r--r--src/test/run-fail/assert-eq-macro-panic.rs4
-rw-r--r--src/test/run-fail/assert-ne-macro-panic.rs17
3 files changed, 30 insertions, 9 deletions
diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs
index 5cb56433ac7..f8316d68578 100644
--- a/src/libcore/macros.rs
+++ b/src/libcore/macros.rs
@@ -117,8 +117,8 @@ macro_rules! assert_eq {
             (left_val, right_val) => {
                 if !(*left_val == *right_val) {
                     panic!(r#"assertion failed: `(left == right)`
-left:  `{:?}`
-right: `{:?}`"#, left_val, right_val)
+  left: `{:?}`
+ right: `{:?}`"#, left_val, right_val)
                 }
             }
         }
@@ -128,8 +128,8 @@ right: `{:?}`"#, left_val, right_val)
             (left_val, right_val) => {
                 if !(*left_val == *right_val) {
                     panic!(r#"assertion failed: `(left == right)`
-left:  `{:?}`
-right: `{:?}`: {}"#, left_val, right_val,
+  left: `{:?}`
+ right: `{:?}`: {}"#, left_val, right_val,
                            format_args!($($arg)+))
                 }
             }
@@ -164,8 +164,9 @@ macro_rules! assert_ne {
         match (&$left, &$right) {
             (left_val, right_val) => {
                 if *left_val == *right_val {
-                    panic!("assertion failed: `(left != right)` \
-                           (left: `{:?}`, right: `{:?}`)", left_val, right_val)
+		    panic!(r#"assertion failed: `(left != right)`
+  left: `{:?}`
+ right: `{:?}`"#, left_val, right_val)
                 }
             }
         }
@@ -174,8 +175,9 @@ macro_rules! assert_ne {
         match (&($left), &($right)) {
             (left_val, right_val) => {
                 if *left_val == *right_val {
-                    panic!("assertion failed: `(left != right)` \
-                           (left: `{:?}`, right: `{:?}`): {}", left_val, right_val,
+                                        panic!(r#"assertion failed: `(left != right)`
+  left: `{:?}`
+ right: `{:?}`: {}"#, left_val, right_val,
                            format_args!($($arg)+))
                 }
             }
diff --git a/src/test/run-fail/assert-eq-macro-panic.rs b/src/test/run-fail/assert-eq-macro-panic.rs
index a3e0a1f904f..fed2ee0beab 100644
--- a/src/test/run-fail/assert-eq-macro-panic.rs
+++ b/src/test/run-fail/assert-eq-macro-panic.rs
@@ -8,7 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// error-pattern:assertion failed: `(left == right)` (left: `14`, right: `15`)
+// error-pattern:assertion failed: `(left == right)`
+// error-pattern: left: `14`
+// error-pattern:right: `15`
 
 fn main() {
     assert_eq!(14, 15);
diff --git a/src/test/run-fail/assert-ne-macro-panic.rs b/src/test/run-fail/assert-ne-macro-panic.rs
new file mode 100644
index 00000000000..d57bb0fb67f
--- /dev/null
+++ b/src/test/run-fail/assert-ne-macro-panic.rs
@@ -0,0 +1,17 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// error-pattern:assertion failed: `(left != right)`
+// error-pattern: left: `14`
+// error-pattern:right: `14`
+
+fn main() {
+    assert_ne!(14, 14);
+}