Browse files

test/ruby/test_rubyoptions.rb: tests for another name

* test/ruby/test_rubyoptions.rb (test_{unused,shadowing_variable):
  tests for another name.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36334 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information...
1 parent 5f7cbbf commit 6e469999135bf3cb05bdda1bd8e598e82aa373dc @nobu nobu committed Jul 7, 2012
Showing with 6 additions and 0 deletions.
  1. +6 −0 test/ruby/test_rubyoptions.rb
View
6 test/ruby/test_rubyoptions.rb
@@ -497,6 +497,7 @@ def test_unused_variable
assert_in_out_err(["-we", "1.times do\n a=1\nend"], "", [], [], feature3446)
assert_in_out_err(["-we", "def foo\n 1.times do\n a=1\n end\nend"], "", [], ["-e:3: warning: assigned but unused variable - a"], feature3446)
assert_in_out_err(["-we", "def foo\n"" 1.times do |a| end\n""end"], "", [], [])
+ assert_in_out_err(["-we", "def foo\n _a=1\nend"], "", [], ["-e:2: warning: assigned but unused variable - _a"], feature3446)
end
def test_shadowing_variable
@@ -508,6 +509,11 @@ def test_shadowing_variable
["-e:3: warning: shadowing outer local variable - a",
"-e:2: warning: assigned but unused variable - a",
], bug4130)
+ assert_in_out_err(["-we", "def foo\n"" _a=1\n"" 1.times do |_a| end\n""end"],
+ "", [],
+ ["-e:3: warning: shadowing outer local variable - _a",
+ "-e:2: warning: assigned but unused variable - _a",
+ ], bug4130)
end
def test_script_from_stdin

0 comments on commit 6e46999

Please sign in to comment.