summaryrefslogtreecommitdiff
path: root/test/ruby/test_rubyoptions.rb
diff options
context:
space:
mode:
authornagachika <nagachika@ruby-lang.org>2020-09-29 22:43:25 +0900
committernagachika <nagachika@ruby-lang.org>2020-09-29 22:43:25 +0900
commitdf3f52a6331f1a47af9933b77311a8650727d8d1 (patch)
treedd16cd215d11caf4907614d0bc6a9b2b08d96930 /test/ruby/test_rubyoptions.rb
parent665589cbdf7bf652067113dd1c0bc49012b990e0 (diff)
merge revision(s) 996af2ce086249e904b2ce95ab2fcd1de7d757be: [Backport #16345] [Backport #17000]
Disable deprecation warning by the default [Feature #16345] And `-w` option turns it on.
Diffstat (limited to 'test/ruby/test_rubyoptions.rb')
-rw-r--r--test/ruby/test_rubyoptions.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb
index 093720b1fc..fba53cd982 100644
--- a/test/ruby/test_rubyoptions.rb
+++ b/test/ruby/test_rubyoptions.rb
@@ -80,6 +80,9 @@ class TestRubyOptions < Test::Unit::TestCase
assert_in_out_err(%w(-W:experimental -e) + ['p Warning[:experimental]'], "", %w(true), [])
assert_in_out_err(%w(-W:no-experimental -e) + ['p Warning[:experimental]'], "", %w(false), [])
assert_in_out_err(%w(-W:qux), "", [], /unknown warning category: `qux'/)
+ assert_in_out_err(%w(-w -e) + ['p Warning[:deprecated]'], "", %w(true), [])
+ assert_in_out_err(%w(-W -e) + ['p Warning[:deprecated]'], "", %w(true), [])
+ assert_in_out_err(%w(-e) + ['p Warning[:deprecated]'], "", %w(false), [])
ensure
ENV['RUBYOPT'] = save_rubyopt
end
@@ -333,6 +336,10 @@ 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"])
+ assert_in_out_err(%w(), "p Warning[:deprecated]", ["true"])
+ assert_in_out_err(%w(-W0), "p Warning[:deprecated]", ["false"])
+ assert_in_out_err(%w(-W1), "p Warning[:deprecated]", ["false"])
+ assert_in_out_err(%w(-W2), "p Warning[:deprecated]", ["true"])
ENV['RUBYOPT'] = '-W:deprecated'
assert_in_out_err(%w(), "p Warning[:deprecated]", ["true"])
ENV['RUBYOPT'] = '-W:no-deprecated'