diff --git a/src/libcoretest/char.rs b/src/libcoretest/char.rs index bed38f8c29666..734e579ec696b 100644 --- a/src/libcoretest/char.rs +++ b/src/libcoretest/char.rs @@ -33,12 +33,12 @@ fn test_is_uppercase() { #[test] fn test_is_whitespace() { assert!(' '.is_whitespace()); - assert!('\u2007'.is_whitespace()); + assert!('\u{2007}'.is_whitespace()); assert!('\t'.is_whitespace()); assert!('\n'.is_whitespace()); assert!(!'a'.is_whitespace()); assert!(!'_'.is_whitespace()); - assert!(!'\u0000'.is_whitespace()); + assert!(!'\u{0000}'.is_whitespace()); } #[test] @@ -92,15 +92,15 @@ fn test_to_uppercase() { #[test] fn test_is_control() { - assert!('\u0000'.is_control()); - assert!('\u0003'.is_control()); - assert!('\u0006'.is_control()); - assert!('\u0009'.is_control()); - assert!('\u007f'.is_control()); - assert!('\u0092'.is_control()); - assert!(!'\u0020'.is_control()); - assert!(!'\u0055'.is_control()); - assert!(!'\u0068'.is_control()); + assert!('\u{0000}'.is_control()); + assert!('\u{0003}'.is_control()); + assert!('\u{0006}'.is_control()); + assert!('\u{0009}'.is_control()); + assert!('\u{007f}'.is_control()); + assert!('\u{0092}'.is_control()); + assert!(!'\u{0020}'.is_control()); + assert!(!'\u{0055}'.is_control()); + assert!(!'\u{0068}'.is_control()); } #[test] @@ -175,9 +175,9 @@ fn test_encode_utf8() { } check('x', &[0x78]); - check('\u00e9', &[0xc3, 0xa9]); - check('\ua66e', &[0xea, 0x99, 0xae]); - check('\U0001f4a9', &[0xf0, 0x9f, 0x92, 0xa9]); + check('\u{00e9}', &[0xc3, 0xa9]); + check('\u{a66e}', &[0xea, 0x99, 0xae]); + check('\u{01f4a9}', &[0xf0, 0x9f, 0x92, 0xa9]); } #[test] @@ -189,17 +189,17 @@ fn test_encode_utf16() { } check('x', &[0x0078]); - check('\u00e9', &[0x00e9]); - check('\ua66e', &[0xa66e]); - check('\U0001f4a9', &[0xd83d, 0xdca9]); + check('\u{00e9}', &[0x00e9]); + check('\u{a66e}', &[0xa66e]); + check('\u{01f4a9}', &[0xd83d, 0xdca9]); } #[test] fn test_len_utf16() { assert!('x'.len_utf16() == 1); - assert!('\u00e9'.len_utf16() == 1); - assert!('\ua66e'.len_utf16() == 1); - assert!('\U0001f4a9'.len_utf16() == 2); + assert!('\u{00e9}'.len_utf16() == 1); + assert!('\u{a66e}'.len_utf16() == 1); + assert!('\u{01f4a9}'.len_utf16() == 2); } #[test] @@ -216,15 +216,15 @@ fn test_width() { assert_eq!('h'.width(false),Some(2)); assert_eq!('h'.width(true),Some(2)); - assert_eq!('\u00AD'.width(false),Some(1)); - assert_eq!('\u00AD'.width(true),Some(1)); + assert_eq!('\u{00AD}'.width(false),Some(1)); + assert_eq!('\u{00AD}'.width(true),Some(1)); - assert_eq!('\u1160'.width(false),Some(0)); - assert_eq!('\u1160'.width(true),Some(0)); + assert_eq!('\u{1160}'.width(false),Some(0)); + assert_eq!('\u{1160}'.width(true),Some(0)); - assert_eq!('\u00a1'.width(false),Some(1)); - assert_eq!('\u00a1'.width(true),Some(2)); + assert_eq!('\u{00a1}'.width(false),Some(1)); + assert_eq!('\u{00a1}'.width(true),Some(2)); - assert_eq!('\u0300'.width(false),Some(0)); - assert_eq!('\u0300'.width(true),Some(0)); + assert_eq!('\u{0300}'.width(false),Some(0)); + assert_eq!('\u{0300}'.width(true),Some(0)); } diff --git a/src/libcoretest/str.rs b/src/libcoretest/str.rs index 763fcccdbfdc8..bfabf9660b9be 100644 --- a/src/libcoretest/str.rs +++ b/src/libcoretest/str.rs @@ -118,6 +118,6 @@ fn test_rev_split_char_iterator_no_trailing() { #[test] fn test_utf16_code_units() { use core::str::Utf16Encoder; - assert_eq!(Utf16Encoder::new(vec!['é', '\U0001F4A9'].into_iter()).collect::>(), + assert_eq!(Utf16Encoder::new(vec!['é', '\u{01F4A9}'].into_iter()).collect::>(), vec![0xE9, 0xD83D, 0xDCA9]) } diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs index 6d143329b0c30..34f0cefb81a96 100644 --- a/src/libserialize/json.rs +++ b/src/libserialize/json.rs @@ -2760,9 +2760,9 @@ mod tests { fn test_write_char() { check_encoder_for_simple!('a', "\"a\""); check_encoder_for_simple!('\t', "\"\\t\""); - check_encoder_for_simple!('\u00a0', "\"\u00a0\""); - check_encoder_for_simple!('\uabcd', "\"\uabcd\""); - check_encoder_for_simple!('\U0010ffff', "\"\U0010ffff\""); + check_encoder_for_simple!('\u{a0}', "\"\u{a0}\""); + check_encoder_for_simple!('\u{abcd}', "\"\u{abcd}\""); + check_encoder_for_simple!('\u{10ffff}', "\"\u{10ffff}\""); } #[test]