summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-06-16 09:20:14 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-06-16 09:20:14 +0000
commitcf79bdc6d013687d99984dee5c79a07ea6ffca07 (patch)
tree34de3d53f5c5b529940ecc2a627ec1aaa995025d /test
parent953f511bb9e8a2fb75b53546b7796936bc4c369d (diff)
* parse.y (warn_unused_var): warn unused variables.
[ruby-dev:41620] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28339 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-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 683677c160..b219e43663 100644
--- a/test/ruby/test_rubyoptions.rb
+++ b/test/ruby/test_rubyoptions.rb
@@ -415,4 +415,10 @@ class TestRubyOptions < Test::Unit::TestCase
ensure
t.close(true) if t
end
+
+ def test_unused_variable
+ feature3446 = '[ruby-dev:41620]'
+ assert_in_out_err(["-we", "a=1"], "", [], ["-e:1: warning: assigned but unused variable a"], feature3446)
+ assert_in_out_err(["-we", "1.times do\n a=1\nend"], "", [], ["-e:2: warning: assigned but unused variable a"], feature3446)
+ end
end