diff options
| author | bors <bors@rust-lang.org> | 2014-12-17 21:33:15 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-12-17 21:33:15 +0000 |
| commit | 22a9f250b5e2de64c13c0f056aec13eb086ef79d (patch) | |
| tree | d996edc2a0a259556be226b4f60437f961fb09b2 /src/libcoretest | |
| parent | 66c297d847ce06a8982d4d322221b17a3cd04f90 (diff) | |
| parent | 5c98952409c9123b5f26b3c620029cd1914a07b6 (diff) | |
| download | rust-22a9f250b5e2de64c13c0f056aec13eb086ef79d.tar.gz rust-22a9f250b5e2de64c13c0f056aec13eb086ef79d.zip | |
auto merge of #19958 : alexcrichton/rust/rollup, r=alexcrichton
Diffstat (limited to 'src/libcoretest')
| -rw-r--r-- | src/libcoretest/char.rs | 41 | ||||
| -rw-r--r-- | src/libcoretest/tuple.rs | 26 |
2 files changed, 19 insertions, 48 deletions
diff --git a/src/libcoretest/char.rs b/src/libcoretest/char.rs index e5561bebb22..bed38f8c296 100644 --- a/src/libcoretest/char.rs +++ b/src/libcoretest/char.rs @@ -135,38 +135,35 @@ fn test_escape_default() { let s = string('~'); assert_eq!(s, "~"); let s = string('\x00'); - assert_eq!(s, "\\x00"); + assert_eq!(s, "\\u{0}"); let s = string('\x1f'); - assert_eq!(s, "\\x1f"); + assert_eq!(s, "\\u{1f}"); let s = string('\x7f'); - assert_eq!(s, "\\x7f"); - let s = string('\u00ff'); - assert_eq!(s, "\\u00ff"); - let s = string('\u011b'); - assert_eq!(s, "\\u011b"); - let s = string('\U0001d4b6'); - assert_eq!(s, "\\U0001d4b6"); + assert_eq!(s, "\\u{7f}"); + let s = string('\u{ff}'); + assert_eq!(s, "\\u{ff}"); + let s = string('\u{11b}'); + assert_eq!(s, "\\u{11b}"); + let s = string('\u{1d4b6}'); + assert_eq!(s, "\\u{1d4b6}"); } #[test] fn test_escape_unicode() { - fn string(c: char) -> String { - let mut result = String::new(); - escape_unicode(c, |c| { result.push(c); }); - return result; - } + fn string(c: char) -> String { c.escape_unicode().collect() } + let s = string('\x00'); - assert_eq!(s, "\\x00"); + assert_eq!(s, "\\u{0}"); let s = string('\n'); - assert_eq!(s, "\\x0a"); + assert_eq!(s, "\\u{a}"); let s = string(' '); - assert_eq!(s, "\\x20"); + assert_eq!(s, "\\u{20}"); let s = string('a'); - assert_eq!(s, "\\x61"); - let s = string('\u011b'); - assert_eq!(s, "\\u011b"); - let s = string('\U0001d4b6'); - assert_eq!(s, "\\U0001d4b6"); + assert_eq!(s, "\\u{61}"); + let s = string('\u{11b}'); + assert_eq!(s, "\\u{11b}"); + let s = string('\u{1d4b6}'); + assert_eq!(s, "\\u{1d4b6}"); } #[test] diff --git a/src/libcoretest/tuple.rs b/src/libcoretest/tuple.rs index c53d82de23c..f7b714757f8 100644 --- a/src/libcoretest/tuple.rs +++ b/src/libcoretest/tuple.rs @@ -16,32 +16,6 @@ fn test_clone() { } #[test] -fn test_getters() { - macro_rules! test_getter( - ($x:expr, $valN:ident, $refN:ident, $mutN:ident, - $init:expr, $incr:expr, $result:expr) => ({ - assert_eq!($x.$valN(), $init); - assert_eq!(*$x.$refN(), $init); - *$x.$mutN() += $incr; - assert_eq!(*$x.$refN(), $result); - }) - ) - let mut x = (0u8, 1u16, 2u32, 3u64, 4u, 5i8, 6i16, 7i32, 8i64, 9i, 10f32, 11f64); - test_getter!(x, val0, ref0, mut0, 0, 1, 1); - test_getter!(x, val1, ref1, mut1, 1, 1, 2); - test_getter!(x, val2, ref2, mut2, 2, 1, 3); - test_getter!(x, val3, ref3, mut3, 3, 1, 4); - test_getter!(x, val4, ref4, mut4, 4, 1, 5); - test_getter!(x, val5, ref5, mut5, 5, 1, 6); - test_getter!(x, val6, ref6, mut6, 6, 1, 7); - test_getter!(x, val7, ref7, mut7, 7, 1, 8); - test_getter!(x, val8, ref8, mut8, 8, 1, 9); - test_getter!(x, val9, ref9, mut9, 9, 1, 10); - test_getter!(x, val10, ref10, mut10, 10.0, 1.0, 11.0); - test_getter!(x, val11, ref11, mut11, 11.0, 1.0, 12.0); -} - -#[test] fn test_tuple_cmp() { let (small, big) = ((1u, 2u, 3u), (3u, 2u, 1u)); |
