Exemplo n.º 1
0
func TestShifterEmptyReader(t *testing.T) {
	var z = NewShifter(test.NewEmptyReader())
	test.That(t, z.Peek(0) == 0, "first character must yield error")
	test.That(t, z.IsEOF(), "empty reader must return EOF")
}
Exemplo n.º 2
0
func TestLexerEmptyReader(t *testing.T) {
	z := NewLexer(test.NewEmptyReader())
	test.That(t, z.Peek(0) == 0, "first character must yield error")
	test.Error(t, z.Err(), io.EOF, "error must be EOF")
	test.That(t, z.Peek(0) == 0, "second peek must also yield error")
}