We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2cec0e7 commit ab4c4f5Copy full SHA for ab4c4f5
lib/mini_racer/truffleruby.rb
@@ -249,7 +249,7 @@ def convert_js_to_ruby(value)
249
elsif map?(value)
250
js_map_to_hash(value)
251
elsif map_iterator?(value)
252
- value.flat_map { |e| convert_js_to_ruby(e) }
+ value.map { |e| convert_js_to_ruby(e) }
253
else
254
object = value
255
h = {}
test/mini_racer_test.rb
@@ -1063,8 +1063,17 @@ def test_map
1063
context = MiniRacer::Context.new
1064
expected = {"x" => 42, "y" => 43}
1065
assert_equal expected, context.eval("new Map([['x', 42], ['y', 43]])")
1066
- expected = ["x", 42, "y", 43]
+ if RUBY_ENGINE == "truffleruby"
1067
+ # See https://github.com/rubyjs/mini_racer/pull/325#discussion_r1907187166
1068
+ expected = [["x", 42], ["y", 43]]
1069
+ else
1070
+ expected = ["x", 42, "y", 43]
1071
+ end
1072
assert_equal expected, context.eval("new Map([['x', 42], ['y', 43]]).entries()")
1073
+ expected = ["x", "y"]
1074
+ assert_equal expected, context.eval("new Map([['x', 42], ['y', 43]]).keys()")
1075
+ expected = [[42], [43]]
1076
+ assert_equal expected, context.eval("new Map([['x', [42]], ['y', [43]]]).values()")
1077
end
1078
1079
def test_regexp_string_iterator
0 commit comments