aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/exp/template/lex_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/exp/template/lex_test.go')
-rw-r--r--src/pkg/exp/template/lex_test.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/pkg/exp/template/lex_test.go b/src/pkg/exp/template/lex_test.go
index 4b4d619bf0..4246b400dd 100644
--- a/src/pkg/exp/template/lex_test.go
+++ b/src/pkg/exp/template/lex_test.go
@@ -128,14 +128,19 @@ var lexTests = []lexTest{
// collect gathers the emitted items into a slice.
func collect(t *lexTest) (items []item) {
l := lex(t.name, t.input)
- for i := range l.items {
- items = append(items, i)
+ for {
+ item := l.nextItem()
+ items = append(items, item)
+ if item.typ == itemEOF || item.typ == itemError {
+ break
+ }
}
return
}
func TestLex(t *testing.T) {
for _, test := range lexTests {
+ println(test.name)
items := collect(&test)
if !reflect.DeepEqual(items, test.items) {
t.Errorf("%s: got\n\t%v\nexpected\n\t%v", test.name, items, test.items)