aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2020-08-31 21:24:36 +0200
committerBenoit Daloze <eregontp@gmail.com>2020-09-15 21:32:35 +0200
commit9b535f3ff7c2f48e34dd44564df7adc723b81276 (patch)
treeea88978c58cd1cc371e6c51a163edb8e3c64e8c1 /test
parentfbba6bd4e3dff7a61965208fecae908f10c4edbe (diff)
downloadruby-9b535f3ff7c2f48e34dd44564df7adc723b81276.tar.gz
Interpolated strings are no longer frozen with frozen-string-literal: true
* Remove freezestring instruction since this was the only usage for it. * [Feature #17104]
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_iseq.rb4
-rw-r--r--test/ruby/test_jit.rb8
-rw-r--r--test/ruby/test_literal.rb2
-rw-r--r--test/ruby/test_rubyoptions.rb6
4 files changed, 6 insertions, 14 deletions
diff --git a/test/ruby/test_iseq.rb b/test/ruby/test_iseq.rb
index 1e7dbe0791..7fb6268f61 100644
--- a/test/ruby/test_iseq.rb
+++ b/test/ruby/test_iseq.rb
@@ -187,8 +187,8 @@ class TestISeq < Test::Unit::TestCase
s1, s2, s3, s4 = compile(code, line, {frozen_string_literal: true}).eval
assert_predicate(s1, :frozen?)
assert_predicate(s2, :frozen?)
- assert_predicate(s3, :frozen?)
- assert_predicate(s4, :frozen?)
+ assert_not_predicate(s3, :frozen?)
+ assert_predicate(s4, :frozen?) # should probably not be frozen, but unrealistic code
end
# Safe call chain is not optimized when Coverage is running.
diff --git a/test/ruby/test_jit.rb b/test/ruby/test_jit.rb
index 6aad9246b6..c0cc28fb42 100644
--- a/test/ruby/test_jit.rb
+++ b/test/ruby/test_jit.rb
@@ -247,14 +247,6 @@ class TestJIT < Test::Unit::TestCase
assert_compile_once('"a#{}b" + "c"', result_inspect: '"abc"', insns: %i[putstring concatstrings tostring])
end
- def test_compile_insn_freezestring
- assert_eval_with_jit("#{<<~"begin;"}\n#{<<~'end;'}", stdout: 'true', success_count: 1, insns: %i[freezestring])
- begin;
- # frozen_string_literal: true
- print proc { "#{true}".frozen? }.call
- end;
- end
-
def test_compile_insn_toregexp
assert_compile_once('/#{true}/ =~ "true"', result_inspect: '0', insns: %i[toregexp])
end
diff --git a/test/ruby/test_literal.rb b/test/ruby/test_literal.rb
index 7f4a329c4a..f5dd093078 100644
--- a/test/ruby/test_literal.rb
+++ b/test/ruby/test_literal.rb
@@ -187,7 +187,7 @@ class TestRubyLiteral < Test::Unit::TestCase
if defined?(RubyVM::InstructionSequence.compile_option) and
RubyVM::InstructionSequence.compile_option.key?(:debug_frozen_string_literal)
def test_debug_frozen_string
- src = 'n = 1; _="foo#{n ? "-#{n}" : ""}"'; f = "test.rb"; n = 1
+ src = '_="foo-1"'; f = "test.rb"; n = 1
opt = {frozen_string_literal: true, debug_frozen_string_literal: true}
str = RubyVM::InstructionSequence.compile(src, f, f, n, **opt).eval
assert_equal("foo-1", str)
diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb
index 754918d17c..7101175568 100644
--- a/test/ruby/test_rubyoptions.rb
+++ b/test/ruby/test_rubyoptions.rb
@@ -1014,11 +1014,11 @@ class TestRubyOptions < Test::Unit::TestCase
err = !freeze ? [] : debug ? with_debug_pat : wo_debug_pat
[
['"foo" << "bar"', err],
- ['"foo#{123}bar" << "bar"', err],
+ ['"foo#{123}bar" << "bar"', []],
['+"foo#{123}bar" << "bar"', []],
- ['-"foo#{123}bar" << "bar"', freeze && debug ? with_debug_pat : wo_debug_pat],
+ ['-"foo#{123}bar" << "bar"', wo_debug_pat],
].each do |code, expected|
- assert_in_out_err(opt, code, [], expected, [opt, code])
+ assert_in_out_err(opt, code, [], expected, "#{opt} #{code}")
end
end
end