Sha256: 2a4c92d7dea6abf76c38be894936bc713ec7140431701f66e580f2ca2af0543f
Contents?: true
Size: 781 Bytes
Versions: 3
Compression:
Stored size: 781 Bytes
Contents
require 'helper' class TestIOListener < Test::Unit::TestCase context "a server" do setup do @device, client_read, client_write = PacketIO::Test::MockServer.build @server = PacketIO::IOListener.new(client_read, client_write) @protocol = PacketIO::LineBasedProtocol.new(@server) end should "exist" do assert_not_nil @server end should "yield packets written to it" do @packets = [] @protocol.on_data { |packet| @packets << packet } @device.write("fo").wait.write("o\n").wait.write("bar\n").eof @server.run! assert_equal ["foo", "bar"], @packets end should "send data" do @protocol << "hello world" data = @device.read_all assert_equal "hello world\n", data end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
packet_io-0.4.0 | test/test_io_listener.rb |
packet_io-0.4.0.rc4 | test/test_io_listener.rb |
packet_io-0.4.0.rc3 | test/test_io_listener.rb |