summaryrefslogtreecommitdiff
path: root/test/ruby/test_iseq.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_iseq.rb')
-rw-r--r--test/ruby/test_iseq.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/ruby/test_iseq.rb b/test/ruby/test_iseq.rb
index 686646ddd8..3938fb3d48 100644
--- a/test/ruby/test_iseq.rb
+++ b/test/ruby/test_iseq.rb
@@ -141,4 +141,17 @@ class TestISeq < Test::Unit::TestCase
assert_raise(TypeError, bug11159) {ISeq.compile(:foo)}
assert_raise(TypeError, bug11159) {ISeq.compile(1)}
end
+
+ def test_frozen_string_literal_compile_option
+ $f = 'f'
+ line = __LINE__ + 2
+ code = <<-'EOS'
+ ['foo', 'foo', "#{$f}foo"]
+ EOS
+ s1, s2, s3 = RubyVM::InstructionSequence.compile(code, __FILE__, __FILE__, line, {frozen_string_literal: true}).eval
+ assert(s1.frozen?)
+ assert(s2.frozen?)
+ assert(s3.frozen?)
+ assert(s1.object_id == s2.object_id)
+ end
end