aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-04-30 14:36:19 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-04-30 14:36:19 +0000
commit4d12807e308cb75de328db0b7a064978e0e04f13 (patch)
treefaaeb51dd422212bf2b3591a342cc36aeb14d5fc /test
parent7132479960cff87e0d7e3fb5cb3919b791edfecc (diff)
downloadruby-4d12807e308cb75de328db0b7a064978e0e04f13.tar.gz
parse.y: %-string cannot be a label
* parse.y (parser_yylex): %-string cannot be a label even if terminated by single/double quotes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_syntax.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb
index dbb18164f4..21752e20d3 100644
--- a/test/ruby/test_syntax.rb
+++ b/test/ruby/test_syntax.rb
@@ -295,6 +295,15 @@ WARN
assert_not_label(:foo, 'class Foo < not_label:foo; end', bug6347)
end
+ def test_no_label_with_percent
+ assert_syntax_error('{%"a": 1}', /unexpected ':'/)
+ assert_syntax_error("{%'a': 1}", /unexpected ':'/)
+ assert_syntax_error('{%Q"a": 1}', /unexpected ':'/)
+ assert_syntax_error("{%Q'a': 1}", /unexpected ':'/)
+ assert_syntax_error('{%q"a": 1}', /unexpected ':'/)
+ assert_syntax_error("{%q'a': 1}", /unexpected ':'/)
+ end
+
def test_duplicated_arg
assert_syntax_error("def foo(a, a) end", /duplicated argument name/)
assert_nothing_raised { def foo(_, _) end }