diff options
author | Michael Muré <batolettre@gmail.com> | 2018-09-09 20:21:49 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2018-09-09 20:22:27 +0200 |
commit | 09e097e1bf32ad153c139e3f6befad9fb059fd6e (patch) | |
tree | 422db558f5ead4ec673bca6a2ede413514d49d5b /cache/query_test.go | |
parent | 21f9840e991ae569ec1efa404011e9a16ed2ab3b (diff) | |
download | git-bug-09e097e1bf32ad153c139e3f6befad9fb059fd6e.tar.gz |
cache: combine sorting and filtering into a query with its micro-DSL
Diffstat (limited to 'cache/query_test.go')
-rw-r--r-- | cache/query_test.go | 30 |
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) + } + } +} |