Bug #763

Mini-unit should not auto-run tests when exiting due to an exception

Added by Paul Brannan about 3 years ago. Updated 10 months ago.

[ruby-core:19990]
Status:Closed Start date:11/20/2008
Priority:Normal Due date:
Assignee:Ryan Davis % Done:

0%

Category:-
Target version:1.9.1 Release Candidate
ruby -v:

Description

[pbrannan@zem tmp]$ cat test.rb
require 'test/unit'

class MyTest < Test::Unit::TestCase
  def test_foo
    assert false, "this function should never get called"
  end
end

# Calling raise here should exit the application without running any tests
raise "HA HA"

[pbrannan@zem tmp]$ ruby1.9 test.rb
/usr/local/lib/ruby1.9/1.9.0/minitest/unit.rb:207: warning: mismatched indentations at 'end' with 'def' at 194
Loaded suite test
Started
F
Finished in 0.002771 seconds.

  1) Failure:
test_foo(MyTest) [test.rb:5]:
this function should never get called

1 tests, 1 assertions, 1 failures, 0 errors, 0 skips
test.rb:9:in `<main>': HA HA (RuntimeError)

History

Updated by Koichi Sasada about 3 years ago

  • Assignee set to Ryan Davis

Updated by Yuki Sonoda about 3 years ago

  • Target version set to 1.9.1 Release Candidate

Updated by Ryan Davis about 3 years ago

This is a general 1.9 bug, I'll search for one or file separately.

% ruby -v -e 'at_exit { p $! }'
ruby 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0]
nil
% ruby -v -e 'at_exit { p $! }; raise "boom"'
ruby 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0]
#<RuntimeError: boom>
-e:1: boom (RuntimeError)
% ./miniruby -I./lib -I.ext/common -I./- -r./ext/purelib.rb  ./runruby.rb --extout=.ext  -- -v -e 'at_exit { p $! }'
ruby 1.9.1 (2008-12-13 revision 20683) [i386-darwin9.5.0]
nil
% ./miniruby -I./lib -I.ext/common -I./- -r./ext/purelib.rb  ./runruby.rb --extout=.ext  -- -v -e 'at_exit { p $! }; raise "boom"'
ruby 1.9.1 (2008-12-13 revision 20683) [i386-darwin9.5.0]
nil
-e:1:in `<main>': boom (RuntimeError)

Updated by Ryan Davis about 3 years ago

  • Status changed from Open to Closed
http://redmine.ruby-lang.org/issues/show/732

Also available in: Atom PDF