Sha256: 6aa319f452d8f7e860fae51e57ee316e823a73ef5796e7859ddaf65c9d463add

Contents?: true

Size: 429 Bytes

Versions: 11

Compression:

Stored size: 429 Bytes

Contents

#! /usr/bin/env ruby
require 'rubygems'
require 'thread/pipe'

describe Thread::Pipe do
	it 'handles passing properly' do
		p = Thread |-> d { d * 2 } |-> d { d * 4 }

		p << 2
		p << 4

		p.deq.should == 16
		p.deq.should == 32
	end

	it 'empty works properly' do
		p = Thread |-> d { sleep 0.2; d * 2 } |-> d { d * 4 }

		p.empty?.should == true
		p.enq 42
		p.empty?.should == false
		p.deq
		p.empty?.should == true
	end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
thread-0.1.4 tests/pipe_spec.rb
thread-0.1.3 tests/pipe_spec.rb
thread-0.1.2 tests/pipe_spec.rb
vinted-thread-0.1.1 tests/pipe_spec.rb
thread-0.1.1 tests/pipe_spec.rb
thread-0.1.0 tests/pipe_spec.rb
thread-0.0.8.1 tests/pipe_spec.rb
thread-0.0.8 tests/pipe_spec.rb
thread-0.0.7 tests/pipe_spec.rb
thread-0.0.6.2 tests/pipe_spec.rb
thread-0.0.6.1 tests/pipe_spec.rb