1
0
Fork 0
mirror of https://github.com/rails/execjs synced 2023-03-27 23:21:20 -04:00

Use unicode notation

This commit is contained in:
Joshua Peek 2014-12-11 11:40:41 -08:00
parent 64dcfcb070
commit c09b116d84

View file

@ -101,7 +101,8 @@ class TestExecJS < Test
"\\",
"café",
"",
"\xf0\x9f\x98\x84".force_encoding("UTF-8"), # Smiling emoji
"\u{1f604}".force_encoding("UTF-8"), # Smiling emoji
"\u{1f1fa}\u{1f1f8}".force_encoding("UTF-8"), # US flag
[1, 2, 3],
[1, [2, 3]],
[1, [2, [3]]],
@ -162,12 +163,12 @@ class TestExecJS < Test
def test_surrogate_pairs
# Smiling emoji
str = "\xf0\x9f\x98\x84".force_encoding("UTF-8")
str = "\u{1f604}".encode("UTF-8")
assert_equal 2, ExecJS.eval("'#{str}'.length")
assert_equal str, ExecJS.eval("'#{str}'")
# US flag emoji
str = "\xf0\x9f\x87\xba\xf0\x9f\x87\xb8".force_encoding("UTF-8")
str = "\u{1f1fa}\u{1f1f8}".force_encoding("UTF-8")
assert_equal 4, ExecJS.eval("'#{str}'.length")
assert_equal str, ExecJS.eval("'#{str}'")
end