mirror of
https://github.com/rails/execjs
synced 2023-03-27 23:21:20 -04:00
Use hex literals
This commit is contained in:
parent
9ef1cd4a99
commit
64dcfcb070
1 changed files with 3 additions and 3 deletions
|
@ -101,7 +101,7 @@ class TestExecJS < Test
|
||||||
"\\",
|
"\\",
|
||||||
"café",
|
"café",
|
||||||
"☃",
|
"☃",
|
||||||
["0ff98948"].pack("h*").force_encoding("UTF-8"), # Smiling emoji
|
"\xf0\x9f\x98\x84".force_encoding("UTF-8"), # Smiling emoji
|
||||||
[1, 2, 3],
|
[1, 2, 3],
|
||||||
[1, [2, 3]],
|
[1, [2, 3]],
|
||||||
[1, [2, [3]]],
|
[1, [2, [3]]],
|
||||||
|
@ -162,12 +162,12 @@ class TestExecJS < Test
|
||||||
|
|
||||||
def test_surrogate_pairs
|
def test_surrogate_pairs
|
||||||
# Smiling emoji
|
# Smiling emoji
|
||||||
str = ["0ff98948"].pack("h*").force_encoding("UTF-8")
|
str = "\xf0\x9f\x98\x84".force_encoding("UTF-8")
|
||||||
assert_equal 2, ExecJS.eval("'#{str}'.length")
|
assert_equal 2, ExecJS.eval("'#{str}'.length")
|
||||||
assert_equal str, ExecJS.eval("'#{str}'")
|
assert_equal str, ExecJS.eval("'#{str}'")
|
||||||
|
|
||||||
# US flag emoji
|
# US flag emoji
|
||||||
str = ["0ff978ab0ff9788b"].pack("h*").force_encoding("UTF-8")
|
str = "\xf0\x9f\x87\xba\xf0\x9f\x87\xb8".force_encoding("UTF-8")
|
||||||
assert_equal 4, ExecJS.eval("'#{str}'.length")
|
assert_equal 4, ExecJS.eval("'#{str}'.length")
|
||||||
assert_equal str, ExecJS.eval("'#{str}'")
|
assert_equal str, ExecJS.eval("'#{str}'")
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue