2025-06-29 23:13:37 +05:00
|
|
|
//! Test ES6-style Unicode escape sequences in string literals.
|
|
|
|
|
//!
|
|
|
|
|
//! Regression test for RFC 446 implementation.
|
|
|
|
|
//! See <https://github.com/rust-lang/rust/pull/19480>.
|
|
|
|
|
|
2019-07-27 00:54:25 +03:00
|
|
|
//@ run-pass
|
|
|
|
|
|
2014-12-02 16:48:48 -08:00
|
|
|
pub fn main() {
|
2025-06-29 23:13:37 +05:00
|
|
|
// Basic Unicode escape - snowman character
|
2014-12-02 16:48:48 -08:00
|
|
|
let s = "\u{2603}";
|
|
|
|
|
assert_eq!(s, "☃");
|
|
|
|
|
|
|
|
|
|
let s = "\u{2a10}\u{2A01}\u{2Aa0}";
|
|
|
|
|
assert_eq!(s, "⨐⨁⪠");
|
|
|
|
|
|
|
|
|
|
let s = "\\{20}";
|
2015-06-08 16:55:35 +02:00
|
|
|
let mut correct_s = String::from("\\");
|
2014-12-02 16:48:48 -08:00
|
|
|
correct_s.push_str("{20}");
|
2015-02-01 21:53:25 -05:00
|
|
|
assert_eq!(s, correct_s);
|
2014-12-02 16:48:48 -08:00
|
|
|
}
|