Sha256: eb20b5800a1a8d83bc5597d279826e307389f201263ba40dec4c7c8fbc541ee2
Contents?: true
Size: 1.53 KB
Versions: 5
Compression:
Stored size: 1.53 KB
Contents
#!/usr/bin/env ruby require 'test/unit' require 'trace' require_relative 'fn_helper' class TestRaise < Test::Unit::TestCase include FnTestHelper def test_raise 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
5 entries across 5 versions & 1 rubygems