File: test_shutdown_hooks.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 (23 lines) | stat: -rw-r--r-- 404 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
require 'em_test_helper'

class TestShutdownHooks < Test::Unit::TestCase
  def test_shutdown_hooks
    r = false
    EM.run {
      EM.add_shutdown_hook { r = true }
      EM.stop
    }
    assert_equal( true, r )
  end

  def test_hook_order
    r = []
    EM.run {
      EM.add_shutdown_hook { r << 2 }
      EM.add_shutdown_hook { r << 1 }
      EM.stop
    }
    assert_equal( [1, 2], r )
  end
end