From 9af083d7f6b97c0f5ebbdd9a42b58478a6f874b7 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 16 Aug 2013 22:08:11 +0000 Subject: test_util: fix encoding test for Ruby trunk (2.1.0dev) 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 @@ class TestUtil < Test::Unit::TestCase 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 @@ class TestUtil < Test::Unit::TestCase 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 } -- cgit v1.2.3-24-ge0c7