aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-07-07 21:36:08 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-07-07 21:36:08 +0000
commit6e469999135bf3cb05bdda1bd8e598e82aa373dc (patch)
tree0c0627de498834d60dd2f16b4b215d2f26144d14 /test/ruby
parent5f7cbbfb68fb7ad4e377eb58cdafd91cff9b3b26 (diff)
downloadruby-6e469999135bf3cb05bdda1bd8e598e82aa373dc.tar.gz
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
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_rubyoptions.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb
index 029eff07d4..62be634c47 100644
--- a/test/ruby/test_rubyoptions.rb
+++ b/test/ruby/test_rubyoptions.rb
@@ -497,6 +497,7 @@ class TestRubyOptions < Test::Unit::TestCase
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 @@ class TestRubyOptions < Test::Unit::TestCase
["-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