]> git.lizzy.rs Git - rust.git/commitdiff
std: adjust str::test_add so that the macro expands to all 3 items (#8012).
authorHuon Wilson <dbau.pp+github@gmail.com>
Mon, 5 Aug 2013 09:46:22 +0000 (19:46 +1000)
committerHuon Wilson <dbau.pp+github@gmail.com>
Wed, 7 Aug 2013 13:17:52 +0000 (23:17 +1000)
Closes #3682.

src/libstd/str.rs

index 95a411a3f96736009bd2461e6dc137a2656badcf..55faf7e319295dec75ab0ce80f1f09a1d8f1078a 100644 (file)
@@ -3304,19 +3304,22 @@ fn test_char_range_at_reverse_underflow() {
     fn test_add() {
         #[allow(unnecessary_allocation)];
         macro_rules! t (
-            ($s1:expr, $s2:expr, $e:expr) => {
-                assert_eq!($s1 + $s2, $e);
-                assert_eq!($s1.to_owned() + $s2, $e);
-                assert_eq!($s1.to_managed() + $s2, $e);
-            }
+            ($s1:expr, $s2:expr, $e:expr) => { {
+                let s1 = $s1;
+                let s2 = $s2;
+                let e = $e;
+                assert_eq!(s1 + s2, e.to_owned());
+                assert_eq!(s1.to_owned() + s2, e.to_owned());
+                assert_eq!(s1.to_managed() + s2, e.to_owned());
+            } }
         );
 
-        t!("foo",  "bar", ~"foobar");
-        t!("foo", @"bar", ~"foobar");
-        t!("foo", ~"bar", ~"foobar");
-        t!("ศไทย中",  "华Việt Nam", ~"ศไทย中华Việt Nam");
-        t!("ศไทย中", @"华Việt Nam", ~"ศไทย中华Việt Nam");
-        t!("ศไทย中", ~"华Việt Nam", ~"ศไทย中华Việt Nam");
+        t!("foo",  "bar", "foobar");
+        t!("foo", @"bar", "foobar");
+        t!("foo", ~"bar", "foobar");
+        t!("ศไทย中",  "华Việt Nam", "ศไทย中华Việt Nam");
+        t!("ศไทย中", @"华Việt Nam", "ศไทย中华Việt Nam");
+        t!("ศไทย中", ~"华Việt Nam", "ศไทย中华Việt Nam");
     }
 
     #[test]