summaryrefslogtreecommitdiff
path: root/test/ruby/test_rubyoptions.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_rubyoptions.rb')
-rw-r--r--test/ruby/test_rubyoptions.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb
index 496a51b970..04a7016ae9 100644
--- a/test/ruby/test_rubyoptions.rb
+++ b/test/ruby/test_rubyoptions.rb
@@ -75,6 +75,9 @@ class TestRubyOptions < Test::Unit::TestCase
assert_in_out_err(%w(-Wx -e) + ['p $-W'], "", %w(1), [])
assert_in_out_err(%w(-W -e) + ['p $-W'], "", %w(2), [])
assert_in_out_err(%w(-w -W0 -e) + ['p $-W'], "", %w(0), [])
+ assert_in_out_err(%w(-W:deprecated -e) + ['p Warning[:deprecated]'], "", %w(true), [])
+ assert_in_out_err(%w(-W:no-deprecated -e) + ['p Warning[:deprecated]'], "", %w(false), [])
+ assert_in_out_err(%w(-W:qux), "", [], /unknown warning category: `qux'/)
ensure
ENV['RUBYOPT'] = save_rubyopt
end
@@ -328,6 +331,12 @@ class TestRubyOptions < Test::Unit::TestCase
assert_in_out_err(%w(), "p $VERBOSE", ["true"])
assert_in_out_err(%w(-W1), "p $VERBOSE", ["false"])
assert_in_out_err(%w(-W0), "p $VERBOSE", ["nil"])
+ ENV['RUBYOPT'] = '-W:deprecated'
+ assert_in_out_err(%w(), "p Warning[:deprecated]", ["true"])
+ ENV['RUBYOPT'] = '-W:no-deprecated'
+ assert_in_out_err(%w(), "p Warning[:deprecated]", ["false"])
+ ENV['RUBYOPT'] = '-W:qux'
+ assert_in_out_err(%w(), "", [], /unknown warning category: `qux'/)
ensure
if rubyopt_orig
ENV['RUBYOPT'] = rubyopt_orig