aboutsummaryrefslogblamecommitdiffstats
path: root/cache/query_test.go
blob: 24d8003527d46d59c589e578442b17f2b78c59b2 (plain) (tree)





























                                                                                                
package cache

import "testing"

func TestQueryParse(t *testing.T) {
	var tests = []struct {
		input string
		ok    bool
	}{
		{"gibberish", false},

		{"status:", false},

		{"status:open", true},
		{"status:closed", true},
		{"status:unknown", false},

		{"author:rene", true},
		// Todo: fix parsing
		// {"author:\"Rene Descartes\"", true},

	}

	for _, test := range tests {
		_, err := ParseQuery(test.input)
		if (err == nil) != test.ok {
			t.Fatalf("Unexpected parse result, expected: %v, err: %v", test.ok, err)
		}
	}
}