summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2025-02-13 17:54:21 -0800
committerTakashi Kokubun <takashikkbn@gmail.com>2025-02-13 17:54:21 -0800
commit9240f01b1fbe5ea4f6a2017d35f8f605f84f0039 (patch)
tree876760a93f9818edaf31bbc968baae23e96342ca /test/ruby
parentc3d30e4dabb2b895c347e10221467dd1b1124ca4 (diff)
merge revision(s) 63723c8d5908569918fb27e070ae5bc9de33c8bd: [Backport #21014]
Correctly set node_id on iseq location The iseq location object has a slot for node ids. parse.y was correctly populating that field but Prism was not. This commit populates the field with the ast node id for that iseq [Bug #21014]
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_compile_prism.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_compile_prism.rb b/test/ruby/test_compile_prism.rb
index 33a8b17b99..a2e8b7bd97 100644
--- a/test/ruby/test_compile_prism.rb
+++ b/test/ruby/test_compile_prism.rb
@@ -3,6 +3,12 @@
# This file is organized to match itemization in https://github.com/ruby/prism/issues/1335
module Prism
class TestCompilePrism < Test::Unit::TestCase
+ def test_iseq_has_node_id
+ code = "proc { <<END }\n hello\nEND"
+ iseq = RubyVM::InstructionSequence.compile_prism(code)
+ assert_operator iseq.to_a[4][:node_id], :>, -1
+ end
+
# Subclass is used for tests which need it
class Subclass; end
############################################################################