diff options
author | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-02-03 07:25:21 +0000 |
---|---|---|
committer | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-02-03 07:25:21 +0000 |
commit | bd5406dfa9c5f952556e39eb3f0fecb4d4ee99ff (patch) | |
tree | 4fe2bbd9508d49a38d80d32ebfea5bba074e52f5 /test/ruby | |
parent | 55e606b36c7ab19d9326073ebd30b81d2325a007 (diff) | |
download | ruby-bd5406dfa9c5f952556e39eb3f0fecb4d4ee99ff.tar.gz |
compile.c: fix string Range optimization with FSL
The optimization in [Feature #13355] needs to be detected
differently to work with "frozen_string_literal: true"
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62177 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_optimization.rb | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/test/ruby/test_optimization.rb b/test/ruby/test_optimization.rb index e8b4f92d92..ac3440a665 100644 --- a/test/ruby/test_optimization.rb +++ b/test/ruby/test_optimization.rb @@ -557,12 +557,14 @@ class TestRubyOptimization < Test::Unit::TestCase when "1.8.0"..."1.8.8" then :bar end end; - iseq = RubyVM::InstructionSequence.compile(code) - insn = iseq.disasm - assert_match %r{putobject\s+#{Regexp.quote('"1.8.0"..."1.8.8"')}}, insn - assert_match %r{putobject\s+#{Regexp.quote('"2.0.0".."2.3.2"')}}, insn - assert_no_match(/putstring/, insn) - assert_no_match(/newrange/, insn) + [ nil, { frozen_string_literal: true } ].each do |opt| + iseq = RubyVM::InstructionSequence.compile(code, nil, nil, opt) + insn = iseq.disasm + assert_match %r{putobject\s+#{Regexp.quote('"1.8.0"..."1.8.8"')}}, insn + assert_match %r{putobject\s+#{Regexp.quote('"2.0.0".."2.3.2"')}}, insn + assert_no_match(/putstring/, insn) + assert_no_match(/newrange/, insn) + end end def test_branch_condition_backquote |