File: test_exc.rb

package info (click to toggle)
ruby-eventmachine 1.0.3-6%2Bdeb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 2,000 kB
  • ctags: 3,178
  • sloc: ruby: 8,641; cpp: 5,217; java: 827; makefile: 5
file content (28 lines) | stat: -rw-r--r-- 650 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
require 'em_test_helper'

class TestSomeExceptions < Test::Unit::TestCase

  # Read the commentary in EM#run.
  # This test exercises the ensure block in #run that makes sure
  # EM#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 EM#run will fail with a C++ exception
  # because the machine wasn't cleaned up properly.

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

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

end