std: adjust str::test_add so that the macro expands to all 3 items (#8012).

Closes #3682.
This commit is contained in:
Huon Wilson
2013-08-05 19:46:22 +10:00
parent f8cf234b34
commit c57fde2b5f

View File

@@ -3304,19 +3304,22 @@ mod tests {
fn test_add() { fn test_add() {
#[allow(unnecessary_allocation)]; #[allow(unnecessary_allocation)];
macro_rules! t ( macro_rules! t (
($s1:expr, $s2:expr, $e:expr) => { ($s1:expr, $s2:expr, $e:expr) => { {
assert_eq!($s1 + $s2, $e); let s1 = $s1;
assert_eq!($s1.to_owned() + $s2, $e); let s2 = $s2;
assert_eq!($s1.to_managed() + $s2, $e); 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!("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!("ศไทย中", @"华Việt Nam", "ศไทย中华Việt Nam");
t!("ศไทย中", ~"华Việt Nam", ~"ศไทย中华Việt Nam"); t!("ศไทย中", ~"华Việt Nam", "ศไทย中华Việt Nam");
} }
#[test] #[test]