about summary refs log tree commit homepage
path: root/test
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-02-26 03:05:21 -0800
committerEric Wong <normalperson@yhbt.net>2010-02-26 03:05:21 -0800
commita5f4d11cdb9465b1ffa2892b3d84ee53b8962930 (patch)
tree293b041f17911abf0e1e66bf50703eba29cc8598 /test
parent4b4ac5ed5d62cab76790661ba92a9ac4d5f1c105 (diff)
downloadunicorn-a5f4d11cdb9465b1ffa2892b3d84ee53b8962930.tar.gz
We'll use struct members exclusively from now on instead of
throwing ivars into the mix.  This allows us to _unofficially_
support direct access to more members easily.  Unofficial
extensions may include the ability to splice(2)/tee(2) for
better performance.

This also makes our object size smaller across all Ruby
implementations as well, too (helps Rainbows! out).
Diffstat (limited to 'test')
-rw-r--r--test/unit/test_tee_input.rb30
1 files changed, 15 insertions, 15 deletions
diff --git a/test/unit/test_tee_input.rb b/test/unit/test_tee_input.rb
index 403f698..ee81a87 100644
--- a/test/unit/test_tee_input.rb
+++ b/test/unit/test_tee_input.rb
@@ -71,8 +71,8 @@ class TestTeeInput < Test::Unit::TestCase
     ti = Unicorn::TeeInput.new(@rd, @env, @parser, @buf)
     assert_equal 0, @parser.content_length
     assert @parser.body_eof?
-    assert_equal StringIO, ti.instance_eval { @tmp.class }
-    assert_equal 0, ti.instance_eval { @tmp.pos }
+    assert_equal StringIO, ti.tmp.class
+    assert_equal 0, ti.tmp.pos
     assert_equal 5, ti.size
     assert_equal 'hello', ti.read
     assert_equal '', ti.read
@@ -99,8 +99,8 @@ class TestTeeInput < Test::Unit::TestCase
     ti = Unicorn::TeeInput.new(@rd, @env, @parser, @buf)
     assert_equal 0, @parser.content_length
     assert @parser.body_eof?
-    assert_kind_of File, ti.instance_eval { @tmp }
-    assert_equal 0, ti.instance_eval { @tmp.pos }
+    assert_kind_of File, ti.tmp
+    assert_equal 0, ti.tmp.pos
     assert_equal Unicorn::Const::MAX_BODY + 1, ti.size
   end
 
@@ -125,9 +125,9 @@ class TestTeeInput < Test::Unit::TestCase
     ti = Unicorn::TeeInput.new(@rd, @env, @parser, @buf)
     assert_equal Unicorn::Const::MAX_BODY, @parser.content_length
     assert ! @parser.body_eof?
-    assert_kind_of File, ti.instance_eval { @tmp }
-    assert_equal 0, ti.instance_eval { @tmp.pos }
-    assert_equal 1, ti.instance_eval { @tmp.size }
+    assert_kind_of File, ti.tmp
+    assert_equal 0, ti.tmp.pos
+    assert_equal 1, ti.tmp.size
     assert_equal Unicorn::Const::MAX_BODY + 1, ti.size
     nr = Unicorn::Const::MAX_BODY / 4
     pid = fork {
@@ -165,19 +165,19 @@ class TestTeeInput < Test::Unit::TestCase
     @wr.close
     ti = Unicorn::TeeInput.new(@rd, @env, @parser, @buf)
     assert_nil @parser.content_length
-    assert_nil ti.instance_eval { @size }
+    assert_nil ti.len
     assert ! @parser.body_eof?
     assert_equal 25, ti.size
     assert @parser.body_eof?
-    assert_equal 25, ti.instance_eval { @size }
-    assert_equal 0, ti.instance_eval { @tmp.pos }
+    assert_equal 25, ti.len
+    assert_equal 0, ti.tmp.pos
     assert_nothing_raised { ti.rewind }
-    assert_equal 0, ti.instance_eval { @tmp.pos }
+    assert_equal 0, ti.tmp.pos
     assert_equal 'abcdeabcdeabcdeabcde', ti.read(20)
-    assert_equal 20, ti.instance_eval { @tmp.pos }
+    assert_equal 20, ti.tmp.pos
     assert_nothing_raised { ti.rewind }
-    assert_equal 0, ti.instance_eval { @tmp.pos }
-    assert_kind_of File, ti.instance_eval { @tmp }
+    assert_equal 0, ti.tmp.pos
+    assert_kind_of File, ti.tmp
     status = nil
     assert_nothing_raised { pid, status = Process.waitpid2(pid) }
     assert status.success?
@@ -203,7 +203,7 @@ class TestTeeInput < Test::Unit::TestCase
     }
     ti = Unicorn::TeeInput.new(@rd, @env, @parser, @buf)
     assert_nil @parser.content_length
-    assert_nil ti.instance_eval { @size }
+    assert_nil ti.len
     assert ! @parser.body_eof?
     chunks.each do |chunk|
       wr.write('.')