mirror of
https://github.com/ruby/ruby.git
synced 2025-08-27 15:06:10 +02:00
Numbered parameters [Feature #4475]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67278 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0fa4a6a618
commit
12acc751e3
8 changed files with 159 additions and 12 deletions
|
@ -363,7 +363,7 @@ class TestParse < Test::Unit::TestCase
|
|||
|
||||
def test_dstr_disallowed_variable
|
||||
bug8375 = '[ruby-core:54885] [Bug #8375]'
|
||||
%w[@ @1 @. @@ @@1 @@. $ $%].each do |src|
|
||||
%w[@ @. @@ @@1 @@. $ $%].each do |src|
|
||||
src = '#'+src+' '
|
||||
str = assert_nothing_raised(SyntaxError, "#{bug8375} #{src.dump}") do
|
||||
break eval('"'+src+'"')
|
||||
|
@ -378,15 +378,15 @@ class TestParse < Test::Unit::TestCase
|
|||
|
||||
def assert_disallowed_variable(type, noname, invalid)
|
||||
noname.each do |name|
|
||||
assert_syntax_error("a = #{name}", "`#{noname[0]}' without identifiers is not allowed as #{type} variable name")
|
||||
assert_syntax_error("proc{a = #{name} }", "`#{noname[0]}' without identifiers is not allowed as #{type} variable name")
|
||||
end
|
||||
invalid.each do |name|
|
||||
assert_syntax_error("a = #{name}", "`#{name}' is not allowed as #{type} variable name")
|
||||
assert_syntax_error("proc {a = #{name} }", "`#{name}' is not allowed as #{type} variable name")
|
||||
end
|
||||
end
|
||||
|
||||
def test_disallowed_instance_variable
|
||||
assert_disallowed_variable("an instance", %w[@ @.], %w[@1])
|
||||
assert_disallowed_variable("an instance", %w[@ @.], %w[])
|
||||
end
|
||||
|
||||
def test_disallowed_class_variable
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue