ruby-changes:57932
From: David <ko1@a...>
Date: Thu, 26 Sep 2019 21:47:56 +0900 (JST)
Subject: [ruby-changes:57932] a2af473018 (master): [rubygems/rubygems] Make sure our modifications to kernel.warn work
https://git.ruby-lang.org/ruby.git/commit/?id=a2af473018 From a2af47301834ede4892dbbe1b7da28317202657e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...> Date: Thu, 12 Sep 2019 09:44:22 +0200 Subject: [rubygems/rubygems] Make sure our modifications to kernel.warn work And test the fix we're adding. https://github.com/rubygems/rubygems/commit/6f86637b98 diff --git a/lib/rubygems/core_ext/kernel_warn.rb b/lib/rubygems/core_ext/kernel_warn.rb index a1dd8ad..96da272 100755 --- a/lib/rubygems/core_ext/kernel_warn.rb +++ b/lib/rubygems/core_ext/kernel_warn.rb @@ -43,6 +43,7 @@ if RUBY_VERSION >= "2.5" https://github.com/ruby/ruby/blob/trunk/lib/rubygems/core_ext/kernel_warn.rb#L43 end uplevel = start end + kw[:uplevel] = uplevel original_warn.call(*messages, **kw) } diff --git a/test/rubygems/test_require.rb b/test/rubygems/test_require.rb index 38b54bd..d1dc994 100644 --- a/test/rubygems/test_require.rb +++ b/test/rubygems/test_require.rb @@ -516,6 +516,21 @@ class TestGemRequire < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_require.rb#L516 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 -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/