diff options
author | Michael Muré <batolettre@gmail.com> | 2020-08-20 12:00:34 +0200 |
---|---|---|
committer | Mike Goldin <mike.goldin@protonmail.ch> | 2020-11-17 08:09:51 -0500 |
commit | b285c57dc62caac2c1f09e74eeece406b0e7cc00 (patch) | |
tree | aa2f15c8e3a250c8bd8d8f4a7b11a5c9819453a8 /query/parser_test.go | |
parent | 902997f53771babb2f9ea1bb6288c2ec295c4c9e (diff) | |
download | git-bug-b285c57dc62caac2c1f09e74eeece406b0e7cc00.tar.gz |
query: expand the tokenizer/parser to parse arbitrary search terms
Diffstat (limited to 'query/parser_test.go')
-rw-r--r-- | query/parser_test.go | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/query/parser_test.go b/query/parser_test.go index 6a509adb..87dd870a 100644 --- a/query/parser_test.go +++ b/query/parser_test.go @@ -13,7 +13,7 @@ func TestParse(t *testing.T) { input string output *Query }{ - {"gibberish", nil}, + // KV {"status:", nil}, {":value", nil}, @@ -62,8 +62,18 @@ func TestParse(t *testing.T) { }}, {"sort:unknown", nil}, - {`status:open author:"René Descartes" participant:leonhard label:hello label:"Good first issue" sort:edit-desc`, + // Search + {"search", &Query{ + Search: []string{"search"}, + }}, + {"search \"more terms\"", &Query{ + Search: []string{"search", "more terms"}, + }}, + + // Complex + {`status:open author:"René Descartes" search participant:leonhard label:hello label:"Good first issue" sort:edit-desc "more terms"`, &Query{ + Search: []string{"search", "more terms"}, Filters: Filters{ Status: []bug.Status{bug.OpenStatus}, Author: []string{"René Descartes"}, |