Skip to content

Commit

Permalink
Use \uXXXX escapes instead of UTF-encoded characters.
Browse files Browse the repository at this point in the history
Writing them this way (from http://www.fileformat.info/info/unicode/char/2603/index.htm and http://www.fileformat.info/info/unicode/char/1f42a/index.htm) ensures that the test code will be parsed correctly no matter what charset Java is using.

This allows us to open-source the test of \u{XXXX} escapes, so our external users will surely be delighted that they can now fill their JavaScript programs with emoji, confident that the transpilation works as expected.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=90732596
  • Loading branch information
tbreisacher authored and blickly committed Apr 11, 2015
1 parent 6d93f3c commit 40db88a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/com/google/javascript/jscomp/Es6ToEs3ConverterTest.java
Expand Up @@ -1905,4 +1905,8 @@ public void testTaggedTemplateLiteral() {
));
}

public void testUnicodeEscapes() {
test("var \\u{73} = \'\\u{2603}\'", "var s = \'\u2603\'"); // ☃
test("var \\u{63} = \'\\u{1f42a}\'", "var c = \'\uD83D\uDC2A\'"); // 🐪
}
}

0 comments on commit 40db88a

Please sign in to comment.