summaryrefslogtreecommitdiffhomepage
path: root/samples/10_advanced_debugging/03_unit_tests/exception_raising_tests.rb
blob: b7e1223ccb2e9d6b6a05533a2cbf95eb047119bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
begin :shared
  class ExceptionalClass
    def initialize exception_to_throw = nil
      raise exception_to_throw if exception_to_throw
    end
  end
end

def test_exception_in_newing_object args, assert
  begin
    ExceptionalClass.new TypeError
    raise "Exception wasn't thrown!"
  rescue Exception => e
    assert.equal! e.class, TypeError, "Exceptions within constructor should be retained."
  end
end

$gtk.reset 100
$gtk.log_level = :off