ruby-changes:61568
From: Nobuyoshi <ko1@a...>
Date: Fri, 5 Jun 2020 10:21:19 +0900 (JST)
Subject: [ruby-changes:61568] 073ff73972 (master): Show better failure messages
https://git.ruby-lang.org/ruby.git/commit/?id=073ff73972 From 073ff7397255c0827463759952982ad901fce7e2 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Fri, 5 Jun 2020 10:20:06 +0900 Subject: Show better failure messages diff --git a/test/rubygems/test_require.rb b/test/rubygems/test_require.rb index d1767cb..6ddb97d 100644 --- a/test/rubygems/test_require.rb +++ b/test/rubygems/test_require.rb @@ -253,7 +253,8 @@ class TestGemRequire < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_require.rb#L253 spaceship_specific_file test before this one" if java_platform? lib_dir = File.expand_path("../../lib", File.dirname(__FILE__)) - if RbConfig::CONFIG["rubylibdir"] == lib_dir + rubylibdir = File.realdirpath(RbConfig::CONFIG["rubylibdir"]) + if rubylibdir == lib_dir # testing in the ruby repository where RubyGems' lib/ == stdlib lib/ # In that case we want to move the stdlib lib/ to still be after b-2 in $LOAD_PATH lp = $LOAD_PATH.dup @@ -286,9 +287,13 @@ class TestGemRequire < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_require.rb#L287 # and as a result #gem_original_require returns false. refute require('benchmark'), "the benchmark stdlib should be recognized as already loaded" - assert $LOAD_PATH.include? b2.load_paths[0] - assert $LOAD_PATH.index(b2.load_paths[0]) < $LOAD_PATH.index(RbConfig::CONFIG["rubylibdir"]), - "this test relies on the b-2 gem lib/ to be before stdlib to make sense" + assert_includes $LOAD_PATH, b2.load_paths[0] + assert_includes $LOAD_PATH, rubylibdir + message = proc { + "this test relies on the b-2 gem lib/ to be before stdlib to make sense\n" + + $LOAD_PATH.pretty_inspect + } + assert_operator $LOAD_PATH.index(b2.load_paths[0]), :<, $LOAD_PATH.index(rubylibdir), message # We detected that we should activate b-2, so we did so, but # then #gem_original_require decided "I've already got some benchmark.rb" loaded. -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/