Sha256: fbe161a1222858be55633f048394022a34c63354a30190f910a936397ba9c217
Contents?: true
Size: 1.63 KB
Versions: 2
Compression:
Stored size: 1.63 KB
Contents
#!/usr/bin/env ruby require 'test/unit' require 'rbconfig' require 'trace' require_relative 'fn_helper' class TestRaise < Test::Unit::TestCase include FnTestHelper def test_raise skip "FIXME on mingw" if RbConfig::CONFIG['target_os'].start_with?('mingw') cmds = [ 'step', 'step', 'raise', 'pr "hi"', ] d = strarray_setup(cmds) d.start ############################## begin x = 1 y = 2 z = 3 rescue RuntimeError d.stop assert 'We are cool with RuntimeError' else d.stop assert false, 'Should have got RuntimeError' end ############################## out = ['-- ', 'begin', '-- ', 'x = 1', '-- ', 'y = 2', '-- ', 'd.stop', '"hi"'] compare_output(out, d, cmds) # Try with explicit Exception name cmds = [ 'next', 'raise [5]', 'raise NotanError', 'step', 'raise TypeError', ] d = strarray_setup(cmds) d.start ############################## begin x = 1 y = 2 z = 3 rescue TypeError d.stop assert 'We are cool with TypeError' else d.stop assert false, 'Should have got TypeError' end ############################## d.stop # ({:remove => true}) out = ['-- ', 'begin', '-- ', 'x = 1', '** "[5]" does not inherit Exception.', '** "NotanError" does not inherit Exception.', '-- ', 'y = 2', '-- ', 'd.stop'] compare_output(out, d, cmds) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
trepanning-1.93.35 | test/functional/test-raise.rb |
trepanning-1.93.32 | test/functional/test-raise.rb |