summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hawthorn <john@hawthorn.email>2021-07-28 20:05:54 -0700
committerAlan Wu <XrXr@users.noreply.github.com>2021-10-20 18:19:38 -0400
commit786e51217806de2d5ba2eb62154045abdfa9771a (patch)
treecd0bf548db5dcb1e07ff950ccce490a7ec6b14be
parent42574768a153bceb303fa74d50eb50a024f98173 (diff)
Add regression test of invalid mapping merge
This should have referenced MAX_TEMP_TYPES, not MAX_LOCAL_TYPES.
-rw-r--r--test/ruby/test_yjit.rb15
1 files changed, 14 insertions, 1 deletions
diff --git a/test/ruby/test_yjit.rb b/test/ruby/test_yjit.rb
index 22b78a4e2d..145305ad09 100644
--- a/test/ruby/test_yjit.rb
+++ b/test/ruby/test_yjit.rb
@@ -141,12 +141,24 @@ class TestYJIT < Test::Unit::TestCase
RUBY
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)
assert_compiles(script)
end
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
YJIT.runtime_stats
YJIT.reset_stats!
@@ -183,6 +195,7 @@ class TestYJIT < Test::Unit::TestCase
RUBY
script = <<~RUBY
+ #{"# frozen_string_literal: true" if frozen_string_literal}
_test_proc = proc {
#{test_script}
}