[PATCH 2/2] test_util: fix encoding test for Ruby trunk (2.1.0dev)

Eric Wong normalperson at yhbt.net
Sat Aug 17 01:20:12 UTC 2013


As of r40610 in ruby trunk, internal encoding is ignored if
external coding is ASCII-8BIT (binary)

ref: r40610 http://svn.ruby-lang.org/repos/ruby/trunk
---
 test/unit/test_util.rb | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/test/unit/test_util.rb b/test/unit/test_util.rb
index b8e4043..904d51c 100644
--- a/test/unit/test_util.rb
+++ b/test/unit/test_util.rb
@@ -80,7 +80,11 @@ def test_reopen_logs_renamed_with_internal_encoding
         File.open(tmp_path, "a:#{ext.to_s}:#{int.to_s}") { |fp|
           fp.sync = true
           assert_equal ext, fp.external_encoding
-          assert_equal int, fp.internal_encoding
+
+          if ext != Encoding::BINARY
+            assert_equal int, fp.internal_encoding
+          end
+
           File.unlink(tmp_path)
           assert ! File.exist?(tmp_path)
           Unicorn::Util.reopen_logs
@@ -88,7 +92,9 @@ def test_reopen_logs_renamed_with_internal_encoding
           assert File.exist?(tmp_path)
           assert_equal fp.stat.inspect, File.stat(tmp_path).inspect
           assert_equal ext, fp.external_encoding
-          assert_equal int, fp.internal_encoding
+          if ext != Encoding::BINARY
+            assert_equal int, fp.internal_encoding
+          end
           assert_equal(EXPECT_FLAGS, EXPECT_FLAGS & fp.fcntl(Fcntl::F_GETFL))
           assert fp.sync
         }
-- 
1.8.3.2.701.g8c4e4ec



More information about the mongrel-unicorn mailing list