diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-10-29 17:34:09 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-10-29 18:53:57 +0900 |
commit | ec2e04c90d96541502c9b96e66900b4bb01676bb (patch) | |
tree | cbc6b0989ab43d53af72396f9801610bdf33847e /test | |
parent | 0ad57158c7fb2892094c6a3b0dc306ba0a8a3735 (diff) |
Preserve the encoding of message from outer local variables
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/5053
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_iseq.rb | 8 | ||||
-rw-r--r-- | test/ruby/test_proc.rb | 6 |
2 files changed, 14 insertions, 0 deletions
diff --git a/test/ruby/test_iseq.rb b/test/ruby/test_iseq.rb index 7125a5ac6d..af92edc494 100644 --- a/test/ruby/test_iseq.rb +++ b/test/ruby/test_iseq.rb @@ -105,6 +105,14 @@ class TestISeq < Test::Unit::TestCase 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 + assert_raise_with_message(ArgumentError, /\(#{name}\)/) do + Ractor.make_shareable(y) + end + end + def test_disasm_encoding src = "\u{3042} = 1; \u{3042}; \u{3043}" asm = compile(src).disasm diff --git a/test/ruby/test_proc.rb b/test/ruby/test_proc.rb index 1f87085f9f..51872e49be 100644 --- a/test/ruby/test_proc.rb +++ b/test/ruby/test_proc.rb @@ -1611,6 +1611,12 @@ class TestProc < Test::Unit::TestCase Proc.new{yield}.isolate end + + name = "\u{2603 26a1}" + assert_raise_with_message(ArgumentError, /\(#{name}\)/) do + eval("#{name} = :#{name}; Proc.new {p #{name}}").isolate + end + # binding :a.tap{|a| |