translate erlectricity list decoder to C
[fuzed.git] / gems / erlectricity / test / port_spec.rb
blob6e4d94844d9565cebaec793ae147bbdb78b5c220
1 require File.dirname(__FILE__) + '/test_helper.rb'
3 context "A port" do
4   specify "should return terms from the queue if it is not empty" do
5     port = FakePort.new()
6     port.queue.clear
7     port.queue << :foo << :bar
8     port.receive.should == :foo
9     port.receive.should == :bar
10     port.receive.should == nil
11   end
12   
13   specify "should read_from_input if the queue gets empty" do
14     port = FakePort.new(:bar)
15     port.queue.clear
16     port.queue << :foo
17     port.receive.should == :foo
18     port.receive.should == :bar
19     port.receive.should == nil
20   end
21   
22   specify "should put the terms in skipped at the front of queue when restore_skipped is called" do
23     port = FakePort.new(:baz)
24     port.queue.clear
25     port.queue << :bar
26     port.skipped << :foo
27     port.restore_skipped
28     
29     port.receive.should == :foo
30     port.receive.should == :bar
31     port.receive.should == :baz
32     port.receive.should == nil
33     
34   end
35 end