Show
Ignore:
Timestamp:
05/23/06 21:13:02 (3 years ago)
Author:
rosejn
Message:

Another round of event api & reactor stuff.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • experiments/io-reactor/test/reactor_test.rb

    r42 r124  
    22 
    33require 'test/unit' 
    4 require 'reactor
     4require 'machine
    55 
    66class TestReactor < Test::Unit::TestCase 
     7  include Machine 
     8 
    79  def setup 
    8     @reactor = EventMachine::Reactor.new 
     10    @reactor = Reactor.instance 
    911  end 
    1012 
    11   def test_delayed_calls 
    12     called = 0 
    13     @reactor.call_in(1) { called += 1 } 
    14     @reactor.call_in(0, proc { called += 1 }) 
    15     @reactor.call_in(2) { @reactor.stop } 
    16     @reactor.run 
    17     assert_equal 2, called, "Delayed calls not firing!" 
    18   end 
    19  
    20   def test_canceled_call 
    21     called = 0 
    22     @reactor.call_in(0) { called += 1 } 
    23     @reactor.call_in(1) { @reactor.stop } 
    24     assert_equal 0, called, "Canceled delayed call still fired!" 
     13  def test_fire_event 
     14    assert true 
    2515  end 
    2616end