Class: TestSomeExceptions

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
lib/ext/eventmachine-0.12.10/tests/test_exc.rb

Instance Method Summary collapse

Instance Method Details

#test_aObject

Read the commentary in EventMachine#run. This test exercises the ensure block in #run that makes sure EventMachine#release_machine gets called even if an exception is thrown within the user code. Without the ensured call to release_machine, the second call to EventMachine#run will fail with a C++ exception because the machine wasn’t cleaned up properly.



39
40
41
42
43
44
45
# File 'lib/ext/eventmachine-0.12.10/tests/test_exc.rb', line 39

def test_a
  assert_raises(RuntimeError) {
    EventMachine.run {
    raise "some exception"
  }
  }
end

#test_bObject



47
48
49
50
51
52
53
# File 'lib/ext/eventmachine-0.12.10/tests/test_exc.rb', line 47

def test_b
  assert_raises(RuntimeError) {
    EventMachine.run {
    raise "some exception"
  }
  }
end