test/test_wbuf.rb in yahns-1.6.0 vs test/test_wbuf.rb in yahns-1.7.0

- old
+ new

@@ -17,11 +17,12 @@ def test_wbuf skip "sendfile not Linux-compatible" if RUBY_PLATFORM !~ /linux/ buf = "*" * (16384 * 2) nr = 1000 [ true, false ].each do |persist| - wbuf = Yahns::Wbuf.new([], persist, Dir.tmpdir) + wbuf = Yahns::Wbuf.new([], persist, Dir.tmpdir, :wait_writable) + assert_equal :wait_writable, wbuf.busy a, b = socketpair assert_nil wbuf.wbuf_write(a, "HIHI") assert_equal "HIHI", b.read(4) nr.times { wbuf.wbuf_write(a, buf) } assert_equal :wait_writable, wbuf.wbuf_flush(a) @@ -67,11 +68,11 @@ a.write_nonblock(buf) rescue Errno::EAGAIN break end while true end - wbuf = Yahns::Wbuf.new([], true, Dir.tmpdir) + wbuf = Yahns::Wbuf.new([], true, Dir.tmpdir, :wait_writable) assert_equal :wait_writable, wbuf.wbuf_write(a, buf) assert_equal :wait_writable, wbuf.wbuf_flush(a) # drain the buffer Timeout.timeout(10) { b.read(b.nread) until b.nread == 0 } @@ -91,10 +92,10 @@ end def test_wbuf_flush_close pipe = cloexec_pipe persist = true - wbuf = Yahns::Wbuf.new(pipe[0], persist, Dir.tmpdir) + wbuf = Yahns::Wbuf.new(pipe[0], persist, Dir.tmpdir, :wait_writable) refute wbuf.respond_to?(:close) # we don't want this for HttpResponse body sp = socketpair rv = nil buf = ("*" * 16384) << "\n"