mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[rubygems/rubygems] Make sure our modifications to kernel.warn work
And test the fix we're adding. https://github.com/rubygems/rubygems/commit/6f86637b98
This commit is contained in:
parent
54839f0173
commit
a2af473018
2 changed files with 16 additions and 0 deletions
|
@ -43,6 +43,7 @@ if RUBY_VERSION >= "2.5"
|
|||
end
|
||||
uplevel = start
|
||||
end
|
||||
|
||||
kw[:uplevel] = uplevel
|
||||
original_warn.call(*messages, **kw)
|
||||
}
|
||||
|
|
|
@ -516,6 +516,21 @@ class TestGemRequire < Gem::TestCase
|
|||
assert_equal "main.rb:1: warning: uplevel\ntest\n", err
|
||||
end
|
||||
end
|
||||
|
||||
def test_no_other_behavioral_changes_with_kernel_warn
|
||||
lib = File.realpath("../../../lib", __FILE__)
|
||||
Dir.mktmpdir("warn_test") do |dir|
|
||||
File.write(dir + "/main.rb", "warn({x:1}, {y:2}, {})\n")
|
||||
_, err = capture_subprocess_io do
|
||||
system(@@ruby, "-w", "-rpp", "--disable=gems", "-I", lib, "-C", dir, "-I.", "main.rb")
|
||||
end
|
||||
assert_equal "{:x=>1}\n{:y=>2}\n", err
|
||||
_, err = capture_subprocess_io do
|
||||
system(@@ruby, "-w", "-rpp", "--enable=gems", "-I", lib, "-C", dir, "-I.", "main.rb")
|
||||
end
|
||||
assert_equal "{:x=>1}\n{:y=>2}\n", err
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def silence_warnings
|
||||
|
|
Loading…
Reference in a new issue