Class: TestProcessWatch
- Inherits:
-
Test::Unit::TestCase
- Object
- Test::Unit::TestCase
- TestProcessWatch
show all
- Defined in:
- lib/ext/eventmachine-0.12.10/tests/test_process_watch.rb
Defined Under Namespace
Modules: ChildProcessWatcher, ParentProcessWatcher
Instance Method Summary
collapse
Instance Method Details
#setup ⇒ Object
22
23
24
|
# File 'lib/ext/eventmachine-0.12.10/tests/test_process_watch.rb', line 22
def setup
EM.kqueue = true if EM.kqueue?
end
|
#teardown ⇒ Object
26
27
28
|
# File 'lib/ext/eventmachine-0.12.10/tests/test_process_watch.rb', line 26
def teardown
EM.kqueue = false if EM.kqueue?
end
|
#test_events ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/ext/eventmachine-0.12.10/tests/test_process_watch.rb', line 30
def test_events
EM.run{
EM.watch_process(Process.pid, ParentProcessWatcher)
$fork_pid = fork{ sleep }
child = EM.watch_process($fork_pid, ChildProcessWatcher)
$pid = child.pid
EM.add_timer(0.5){
Process.kill('TERM', $fork_pid)
}
}
assert_equal($pid, $fork_pid)
assert($forked)
assert($exited)
assert($unbind)
end
|