diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-09-27 06:44:02 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-09-27 06:44:02 +0000 |
commit | 0c68198cc49431c683ffb9915e67cd05f625553a (patch) | |
tree | 2f87021f6f7a577c1ab65ed51191bd448e39570e /test/ruby | |
parent | 868a0970b6503c402d1190ecc00c7cd4c9521ece (diff) | |
download | ruby-0c68198cc49431c683ffb9915e67cd05f625553a.tar.gz |
fronzen-string-literal pragma
* compile.c (iseq_compile_each): override compile option by option
given by pragma.
* iseq.c (rb_iseq_make_compile_option): extract a function to
overwrite rb_compile_option_t.
* parse.y (parser_set_compile_option_flag): introduce pragma to
override compile options.
* parse.y (magic_comments): new pragma "fronzen-string-literal".
[Feature #8976]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51953 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_literal.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/ruby/test_literal.rb b/test/ruby/test_literal.rb index 302f487bb6..0d65ebac2c 100644 --- a/test/ruby/test_literal.rb +++ b/test/ruby/test_literal.rb @@ -121,6 +121,19 @@ class TestRubyLiteral < Test::Unit::TestCase assert_equal "foo\n", `echo #{s}` end + def test_frozen_string + all_assertions do |a| + a.for("false") do + str = eval("# -*- frozen-string-literal: false -*-\n""'foo'") + assert_not_predicate(str, :frozen?) + end + a.for("true") do + str = eval("# -*- frozen-string-literal: true -*-\n""'foo'") + assert_predicate(str, :frozen?) + end + end + end + def test_regexp assert_instance_of Regexp, // assert_match(//, 'a') |