diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-12-20 23:05:22 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-12-20 23:05:22 +0900 |
commit | a84ad24386d27269b90794146c2a351c1d79471b (patch) | |
tree | f4ab0524c182f1e0c080d0f999813b2326aa8f99 /test | |
parent | 6876aa38f607cdd6fb24910e54143d9110d025c9 (diff) | |
download | ruby-a84ad24386d27269b90794146c2a351c1d79471b.tar.gz |
Added -W: command line option
To manage `Warning[category]` flags. Only `-W:deprecated` and
`-W:no-deprecated` are available now. [Feature #16345]
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_rubyoptions.rb | 9 |
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 |