Project

General

Profile

« Previous | Next » 

Revision 28f7a46f

Added by Vít Ondruch about 2 years ago

[rubygems/rubygems] Provide more insightful test error output

Original output:

Failure: test_realworld_upgraded_default_gem(TestGemRequire): <false> is not true. /mnt/test/rubygems/test_require.rb:474:in `test_realworld_upgraded_default_gem' 471: File.write(path, code) 472: 473: output = Gem::Util.popen({ "GEM_HOME" => @gemhome }, *ruby_with_rubygems_in_load_path, path).strip => 474: assert $?.success? 475: refute_empty output 476: assert_equal "999.99.9", output.lines[0].chomp 477: # Make sure only files from the newer json gem are loaded, and no files from the default json gem 

New output:

Failure: test_realworld_upgraded_default_gem(TestGemRequire) /mnt/test/rubygems/test_require.rb:475:in `test_realworld_upgraded_default_gem' 472: 473: output = Gem::Util.popen({ "GEM_HOME" => @gemhome }, *ruby_with_rubygems_in_load_path, path).strip 474: refute_empty output => 475: assert_equal "999.99.9", output.lines[0].chomp 476: # Make sure only files from the newer json gem are loaded, and no files from the default json gem 477: assert_equal ["#{@gemhome}/gems/json-999.99.9/lib/json.rb"], output.lines.grep(%r{/gems/json-}).map(&:chomp) 478: assert $?.success? <"999.99.9"> expected but was <"/mnt/tmp/test_rubygems_20231110-36663-of405r/test_realworld_upgraded_default_gem.rb:3:in `<main>': undefined method `version' for nil:NilClass (NoMethodError)"> diff: ? 999 .99.9 ? /mnt/tmp/test_rubygems_20231110-36663-of405r/test_realworld_upgraded_default_gem rb:3:in `<main>': undefined method `version' for nil:NilClass (NoMethodError) ? ??? ???? 

It is more valuable to check the command output then the error code. If
the command fails for some reason, the output probably contains some
detail, while checking the return code tells not much.

https://github.com/rubygems/rubygems/commit/b76062e852