diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-10-21 09:34:09 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-10-21 09:34:09 +0000 |
commit | e7968e3719f4fcb14c4e886a03de505693045a43 (patch) | |
tree | e32da41d359126f5ccc7bff7f5431fa76276b8a4 /test/ruby | |
parent | 12e58e052c81193f7c9a2359551e4d7b329ccbba (diff) | |
download | ruby-e7968e3719f4fcb14c4e886a03de505693045a43.tar.gz |
parse.y: magic comment w/o indicators
* parse.y (parser_magic_comment): allow a sole magic comment without
indicators, neither other non-space comments. [Feature #8976]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52208 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_literal.rb | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/test/ruby/test_literal.rb b/test/ruby/test_literal.rb index 0d65ebac2c..e523f11cd7 100644 --- a/test/ruby/test_literal.rb +++ b/test/ruby/test_literal.rb @@ -123,14 +123,38 @@ class TestRubyLiteral < Test::Unit::TestCase def test_frozen_string all_assertions do |a| - a.for("false") do + a.for("false with indicator") do str = eval("# -*- frozen-string-literal: false -*-\n""'foo'") assert_not_predicate(str, :frozen?) end - a.for("true") do + a.for("true with indicator") do str = eval("# -*- frozen-string-literal: true -*-\n""'foo'") assert_predicate(str, :frozen?) end + a.for("false without indicator") do + str = eval("# frozen-string-literal: false\n""'foo'") + assert_not_predicate(str, :frozen?) + end + a.for("true without indicator") do + str = eval("# frozen-string-literal: true\n""'foo'") + assert_predicate(str, :frozen?) + end + a.for("false with preceding garbage") do + str = eval("# x frozen-string-literal: false\n""'foo'") + assert_not_predicate(str, :frozen?) + end + a.for("true with preceding garbage") do + str = eval("# x frozen-string-literal: true\n""'foo'") + assert_not_predicate(str, :frozen?) + end + a.for("false with succeeding garbage") do + str = eval("# frozen-string-literal: false x\n""'foo'") + assert_not_predicate(str, :frozen?) + end + a.for("true with succeeding garbage") do + str = eval("# frozen-string-literal: true x\n""'foo'") + assert_not_predicate(str, :frozen?) + end end end |