ruby-changes:69092
From: John <ko1@a...>
Date: Thu, 21 Oct 2021 08:20:48 +0900 (JST)
Subject: [ruby-changes:69092] 786e512178 (master): Add regression test of invalid mapping merge
https://git.ruby-lang.org/ruby.git/commit/?id=786e512178 From 786e51217806de2d5ba2eb62154045abdfa9771a Mon Sep 17 00:00:00 2001 From: John Hawthorn <john@h...> Date: Wed, 28 Jul 2021 20:05:54 -0700 Subject: Add regression test of invalid mapping merge This should have referenced MAX_TEMP_TYPES, not MAX_LOCAL_TYPES. --- test/ruby/test_yjit.rb | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_yjit.rb#L141 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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_yjit.rb#L195 RUBY script = <<~RUBY + #{"# frozen_string_literal: true" if frozen_string_literal} _test_proc = proc { #{test_script} } -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/