diff options
Diffstat (limited to 'test/ruby/test_iseq.rb')
-rw-r--r-- | test/ruby/test_iseq.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/ruby/test_iseq.rb b/test/ruby/test_iseq.rb index 692549efa0..49f12019dc 100644 --- a/test/ruby/test_iseq.rb +++ b/test/ruby/test_iseq.rb @@ -125,6 +125,16 @@ class TestISeq < Test::Unit::TestCase assert_equal(42, ISeq.load_from_binary(iseq.to_binary).eval) end + def test_super_with_anonymous_block + iseq = compile(<<~EOF) + def touch3(&block) # :nodoc: + foo { super } + end + 42 + EOF + assert_equal(42, ISeq.load_from_binary(iseq.to_binary).eval) + end + def test_ractor_unshareable_outer_variable name = "\u{2603 26a1}" y = eval("proc {#{name} = nil; proc {|x| #{name} = x}}").call @@ -373,6 +383,14 @@ class TestISeq < Test::Unit::TestCase assert_equal [2], param_names end + def anon_block(&); end + + def test_anon_block_param_in_disasm + iseq = RubyVM::InstructionSequence.of(method(:anon_block)) + param_names = iseq.to_a[iseq.to_a.index(:method) + 1] + assert_equal [:&], param_names + end + def strip_lineno(source) source.gsub(/^.*?: /, "") end |