From b285c57dc62caac2c1f09e74eeece406b0e7cc00 Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Thu, 20 Aug 2020 12:00:34 +0200 Subject: query: expand the tokenizer/parser to parse arbitrary search terms --- query/parser_test.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'query/parser_test.go') diff --git a/query/parser_test.go b/query/parser_test.go index 6a509adb7..87dd870a9 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"}, -- cgit v1.2.3