diff options
author | nagachika <nagachika@ruby-lang.org> | 2021-02-20 17:29:32 +0900 |
---|---|---|
committer | nagachika <nagachika@ruby-lang.org> | 2021-02-20 17:29:32 +0900 |
commit | 14823c2d7c20dba288025749b4d55c02d8729871 (patch) | |
tree | 2b542bf52642231d92b71f40c3f42e192789ecdc /test/ruby | |
parent | 69d01653f831052acdc803aad0b78690ad61ca86 (diff) |
merge revision(s) 6f6dfdcc685077f0f85dcdd63843ecfc0f6fbfb6: [Backport #17523]
Make warning values consistent [Bug #17523]
They should be affected, as well as `$VERBOSE`, by `-w`/`-W`
options, not only in the main script but in scripts loaded by `-r`
option too.
---
ruby.c | 4 ++--
test/ruby/test_rubyoptions.rb | 9 +++++++++
2 files changed, 11 insertions(+), 2 deletions(-)
Diffstat (limited to 'test/ruby')
-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 fba53cd982..26e7f5dca3 100644 --- a/test/ruby/test_rubyoptions.rb +++ b/test/ruby/test_rubyoptions.rb @@ -83,6 +83,15 @@ class TestRubyOptions < Test::Unit::TestCase 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), []) + code = 'puts "#{$VERBOSE}:#{Warning[:deprecated]}:#{Warning[:experimental]}"' + Tempfile.create(["test_ruby_test_rubyoption", ".rb"]) do |t| + t.puts code + t.close + assert_in_out_err(["-r#{t.path}", '-e', code], "", %w(false:false:true false:false:true), []) + assert_in_out_err(["-r#{t.path}", '-w', '-e', code], "", %w(true:true:true true:true:true), []) + assert_in_out_err(["-r#{t.path}", '-W:deprecated', '-e', code], "", %w(false:true:true false:true:true), []) + assert_in_out_err(["-r#{t.path}", '-W:no-experimental', '-e', code], "", %w(false:false:false false:false:false), []) + end ensure ENV['RUBYOPT'] = save_rubyopt end |