Created
November 8, 2011 16:01
-
-
Save griff/1348180 to your computer and use it in GitHub Desktop.
Test to illustrate that JRuby on windows doesn't correctly transfer binmode to a duplicate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'test/unit' | |
include Test::Unit::Assertions | |
EXPECTED = "\211PNG\r\n\032\n" | |
File.open('test.dmp', 'wb') do |f| | |
f.write(EXPECTED) | |
end | |
o = File.new('test.dmp', 'rb') | |
assert_equal EXPECTED, o.read(8), "not in binmode" # works | |
o.seek(0,0) | |
od = o.dup | |
assert_equal EXPECTED, od.read(8), "dup not in binmode" # fails |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment