test/io_test.rb in bindata-1.8.2 vs test/io_test.rb in bindata-1.8.3
- old
+ new
@@ -150,9 +150,24 @@
io.writebytes("abcd")
stream.value.must_equal "abcd"
end
+ it "has #offset" do
+ io.offset.must_equal 0
+
+ io.writebytes("abcd")
+ io.offset.must_equal 4
+
+ io.writebytes("ABCD")
+ io.offset.must_equal 8
+ end
+
+ it "rounds up #offset when writing bits" do
+ io.writebits(123, 9, :little)
+ io.offset.must_equal 2
+ end
+
it "flushes" do
io.writebytes("abcd")
io.flush
stream.value.must_equal "abcd"