5 class TestPeek < Test::Unit::TestCase
6 class EIEIO < Errno::EIO
15 @rd, @wr = Kgio::UNIXSocket.pair
16 @wr.kgio_write "HELLO"
17 assert_equal "HELLO", @rd.kgio_peek(5)
18 assert_equal "HELLO", @rd.kgio_trypeek(5)
19 assert_equal "HELLO", @rd.kgio_read(5)
20 assert_equal :wait_readable, @rd.kgio_trypeek(5)
21 def @rd.kgio_wait_readable
24 assert_raises(EIEIO) { @rd.kgio_peek(5) }
27 def test_peek_singleton
28 @rd, @wr = UNIXSocket.pair
30 assert_equal "HELLO", Kgio.trypeek(@rd, 666)
31 assert_equal "HELLO", Kgio.trypeek(@rd, 666)
32 assert_equal "HELLO", Kgio.tryread(@rd, 666)
33 assert_equal :wait_readable, Kgio.trypeek(@rd, 5)