func TestLexer_Lex(t *testing.T) {
	var tests = []struct {
		s   string
		tok Token
		lit string
	}{
		{s: ``, tok: EOF},
		{s: ` `, tok: WS, lit: " "},
		{s: "\t", tok: WS, lit: "\t"},
		{s: " ws", tok: WS, lit: " "},
		{s: ":", tok: COLON, lit: ":"},
		{s: `foo`, tok: STRING, lit: `foo`},
		{s: `_foo`, tok: STRING, lit: `_foo`},
		{s: `"qux.qaz`, tok: STRING, lit: `"qux.qaz`},
		{s: "apache.status", tok: STRING, lit: "apache.status"},
		{s: "time", tok: STRING, lit: "time"},
		{s: "_myfield:", tok: STRING, lit: "_myfield"},
		{s: "500)", tok: STRING, lit: "500"},
		{s: "AND", tok: AND, lit: "AND"},
		{s: "OR", tok: OR, lit: "OR"},
		{s: "NOT", tok: NOT, lit: "NOT"},
		{s: "NoT", tok: NOT, lit: "NoT"},
		{s: `(foo`, tok: LPAREN, lit: "("},
		{s: `)`, tok: RPAREN, lit: ")"},
	}
	for i, tt := range tests {
		s := NewLexer(strings.NewReader(tt.s))
		tok, lit := s.Lex()
		if tt.tok != tok {
			t.Errorf("%d. %q token mismatch: exp=%q got=%q <%q>", i, tt.s, tt.tok, tok, lit)
		} else if tt.lit != lit {
			t.Errorf("%d. %q literal mismatch: exp=%q got=%q", i, tt.s, tt.lit, lit)
		}
	}
}
Test lexing of individual tokens
package query
import (
	"reflect"
	"strings"
	"testing"
)