Reader test reading a 1-byte file.

This commit is contained in:
Ferdinand Majerech 2014-07-21 09:53:58 +02:00
parent d77646555d
commit 9888925d23

View file

@ -694,9 +694,21 @@ void testUTF(R)()
utf_test(data, endian == Endian.bigEndian ? BOM.UTF32BE : BOM.UTF32LE); utf_test(data, endian == Endian.bigEndian ? BOM.UTF32BE : BOM.UTF32LE);
} }
void test1Byte(R)()
{
writeln(typeid(R).toString() ~ ": 1 byte file unittest");
ubyte[] data = [97];
auto reader = new R(new MemoryStream(data));
assert(reader.peek() == 'a');
assert(reader.peek(1) == '\0');
assert(collectException(reader.peek(2)));
}
unittest unittest
{ {
testEndian!Reader(); testEndian!Reader();
testPeekPrefixForward!Reader(); testPeekPrefixForward!Reader();
testUTF!Reader(); testUTF!Reader();
test1Byte!Reader();
} }