test/test_bychar.rb in bychar-1.0.1 vs test/test_bychar.rb in bychar-1.1.0
- old
+ new
@@ -43,6 +43,18 @@
reader = Bychar::Reader.new(s, 1)
s.length.times { reader.read_one_byte }
assert reader.eof?
end
+ def test_read_one_byte_and_raise_at_eof
+ str = "Frobobo"
+
+ bytes = []
+ assert_raise(Bychar::EOFError) do
+ s = Bychar::Reader.new(StringIO.new(str))
+ loop { bytes << s.read_one_byte! }
+ end
+
+ assert_equal %w( F r o b o b o ), bytes
+ end
+
end