mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Add regression test of invalid mapping merge
This should have referenced MAX_TEMP_TYPES, not MAX_LOCAL_TYPES.
This commit is contained in:
parent
42574768a1
commit
786e512178
1 changed files with 14 additions and 1 deletions
|
@ -141,12 +141,24 @@ class TestYJIT < Test::Unit::TestCase
|
||||||
RUBY
|
RUBY
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_ctx_different_mappings
|
||||||
|
# regression test simplified from URI::Generic#hostname=
|
||||||
|
assert_compiles(<<~'RUBY', frozen_string_literal: true)
|
||||||
|
def foo(v)
|
||||||
|
!(v&.start_with?('[')) && v&.index(':')
|
||||||
|
end
|
||||||
|
|
||||||
|
foo(nil)
|
||||||
|
foo("example.com")
|
||||||
|
RUBY
|
||||||
|
end
|
||||||
|
|
||||||
def assert_no_exits(script)
|
def assert_no_exits(script)
|
||||||
assert_compiles(script)
|
assert_compiles(script)
|
||||||
end
|
end
|
||||||
|
|
||||||
ANY = Object.new
|
ANY = Object.new
|
||||||
def assert_compiles(test_script, insns: [], min_calls: 1, stdout: nil, exits: {}, result: ANY)
|
def assert_compiles(test_script, insns: [], min_calls: 1, stdout: nil, exits: {}, result: ANY, frozen_string_literal: nil)
|
||||||
reset_stats = <<~RUBY
|
reset_stats = <<~RUBY
|
||||||
YJIT.runtime_stats
|
YJIT.runtime_stats
|
||||||
YJIT.reset_stats!
|
YJIT.reset_stats!
|
||||||
|
@ -183,6 +195,7 @@ class TestYJIT < Test::Unit::TestCase
|
||||||
RUBY
|
RUBY
|
||||||
|
|
||||||
script = <<~RUBY
|
script = <<~RUBY
|
||||||
|
#{"# frozen_string_literal: true" if frozen_string_literal}
|
||||||
_test_proc = proc {
|
_test_proc = proc {
|
||||||
#{test_script}
|
#{test_script}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue