Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 8e749cd4bd
Fetching contributors…

Cannot retrieve contributors at this time

24 lines (19 sloc) 0.522 kb
require 'abstract_unit'
require 'active_support/core_ext/io'
class IOTest < Test::Unit::TestCase
def test_binread_one_arg
assert_equal File.read(__FILE__), IO.binread(__FILE__)
end
def test_binread_two_args
assert_equal File.read(__FILE__).bytes.first(10).pack('C*'),
IO.binread(__FILE__, 10)
end
def test_binread_three_args
actual = IO.binread(__FILE__, 5, 10)
expected = File.open(__FILE__, 'rb') { |f|
f.seek 10
f.read 5
}
assert_equal expected, actual
end
end
Jump to Line
Something went wrong with that request. Please try again.