lf/scan_test.go
2016-12-18 21:34:41 +03:00

23 lines
406 B
Go

package main
import (
"strings"
"testing"
)
func TestScan(t *testing.T) {
for _, test := range gEvalTests {
s := newScanner(strings.NewReader(test.inp))
for _, tok := range test.toks {
if s.scan(); s.tok != tok {
t.Errorf("at input '%s' expected '%s' but scanned '%s'", test.inp, tok, s.tok)
}
}
if s.scan() {
t.Errorf("at input '%s' unexpected '%s'", test.inp, s.tok)
}
}
}