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 | a76fdea9fc923583461ee9149120a677fe6a8bae (patch) | |
tree | e32da41d359126f5ccc7bff7f5431fa76276b8a4 /test/ruby/test_literal.rb | |
parent | 5fe691934438438e33cde5890bc3b6696537e538 (diff) |
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/test_literal.rb')
-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 |