aboutsummaryrefslogtreecommitdiffstats
path: root/cache/query_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'cache/query_test.go')
-rw-r--r--cache/query_test.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/cache/query_test.go b/cache/query_test.go
new file mode 100644
index 00000000..24d80035
--- /dev/null
+++ b/cache/query_test.go
@@ -0,0 +1,30 @@
+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)
+ }
+ }
+}