From 133523706715b6e95d2bf410886560f21a23b1e8 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 6 Jun 2016 05:00:11 +0000 Subject: wbuf: remove tmpdir parameter We can retrieve it when we actually need to create the temporary file. This saves an ivar slot and method dispatch parameters. This patch is nice, unfortunately the patch which follows is not :P --- test/test_wbuf.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/test_wbuf.rb b/test/test_wbuf.rb index 990ad9d..1382086 100644 --- a/test/test_wbuf.rb +++ b/test/test_wbuf.rb @@ -9,6 +9,9 @@ class TestWbuf < Testcase class KgioUS < UNIXSocket include Kgio::SocketMethods + def self.output_buffer_tmpdir + Dir.tmpdir + end end def socketpair @@ -20,7 +23,7 @@ class TestWbuf < Testcase buf = "*" * (16384 * 2) nr = 1000 [ true, false ].each do |persist| - wbuf = Yahns::Wbuf.new([], persist, Dir.tmpdir) + wbuf = Yahns::Wbuf.new([], persist) assert_equal false, wbuf.busy a, b = socketpair assert_nil wbuf.wbuf_write(a, "HIHI") @@ -71,7 +74,7 @@ class TestWbuf < Testcase break end while true end - wbuf = Yahns::Wbuf.new([], true, Dir.tmpdir) + wbuf = Yahns::Wbuf.new([], true) rv1 = wbuf.wbuf_write(a, buf) rv2 = wbuf.wbuf_flush(a) @@ -104,7 +107,7 @@ class TestWbuf < Testcase 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) refute wbuf.respond_to?(:close) # we don't want this for HttpResponse body sp = socketpair rv = nil -- cgit v1.2.3-24-ge0c7