From a84ad24386d27269b90794146c2a351c1d79471b Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Fri, 20 Dec 2019 23:05:22 +0900 Subject: Added -W: command line option To manage `Warning[category]` flags. Only `-W:deprecated` and `-W:no-deprecated` are available now. [Feature #16345] --- test/ruby/test_rubyoptions.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test') 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 -- cgit v1.2.3