func verifyLexerTokens(l *lex.Lexer, tokens []lex.Token) { for _, goodToken := range tokens { tok := l.NextToken() if tok.T != goodToken.T || tok.V != goodToken.V { panic(fmt.Sprintf("bad token: %v but wanted %v\n", tok, goodToken)) } else { fmt.Printf("Got good token: %v\n", tok) } } }