Skip to content

Instantly share code, notes, and snippets.

@griff
Created November 8, 2011 16:01
Show Gist options
  • Save griff/1348180 to your computer and use it in GitHub Desktop.
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
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