Skip to content
This repository has been archived by the owner on Jun 10, 2018. It is now read-only.

Commit

Permalink
Use unicode notation
Browse files Browse the repository at this point in the history
  • Loading branch information
josh committed Dec 11, 2014
1 parent 64dcfcb commit c09b116
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions test/test_execjs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ def test_json_values
"\\",
"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]]],
Expand Down Expand Up @@ -162,12 +163,12 @@ def test_encoding_compile

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
Expand Down

0 comments on commit c09b116

Please sign in to comment.