1
0
Fork 0
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:
David Rodríguez 2019-09-12 09:44:22 +02:00 committed by Hiroshi SHIBATA
parent 54839f0173
commit a2af473018
No known key found for this signature in database
GPG key ID: F9CF13417264FAC2
2 changed files with 16 additions and 0 deletions

View file

@ -43,6 +43,7 @@ if RUBY_VERSION >= "2.5"
end
uplevel = start
end
kw[:uplevel] = uplevel
original_warn.call(*messages, **kw)
}

View file

@ -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