summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-18 17:12:34 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-18 17:12:34 +0000
commitb7c90baf074156456e2ba5216c492e8b79b8bc3c (patch)
tree29c046d3658f2121deca2d222c116bfffdc3082c /test
parent9dc33b83bb866e0bc0c4d67e32040b31d26e0738 (diff)
merge revision(s) 53753,54131: [Backport #8851]
lex.c.blt: update * lex.c.blt: follows r52429, not removing casts to int. * defs/keywords (alias, undef): symbol literals are allowed. * parse.y (parse_percent): should parse symbol literals for alias and undef. [ruby-dev:47681] [Bug #8851] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@54642 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_syntax.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb
index 9f3bd0dab3..50c3e7e6b5 100644
--- a/test/ruby/test_syntax.rb
+++ b/test/ruby/test_syntax.rb
@@ -781,6 +781,30 @@ eom
end
end
+ def test_alias_symbol
+ bug8851 = '[ruby-dev:47681] [Bug #8851]'
+ formats = ['%s', ":'%s'", ':"%s"', '%%s(%s)']
+ all_assertions(bug8851) do |all|
+ formats.product(formats) do |form1, form2|
+ all.for(code = "alias #{form1 % 'a'} #{form2 % 'p'}") do
+ assert_valid_syntax(code)
+ end
+ end
+ end
+ end
+
+ def test_undef_symbol
+ bug8851 = '[ruby-dev:47681] [Bug #8851]'
+ formats = ['%s', ":'%s'", ':"%s"', '%%s(%s)']
+ all_assertions(bug8851) do |all|
+ formats.product(formats) do |form1, form2|
+ all.for(code = "undef #{form1 % 'a'}, #{form2 % 'p'}") do
+ assert_valid_syntax(code)
+ end
+ end
+ end
+ end
+
private
def not_label(x) @result = x; @not_label ||= nil end