diff options
author | Michael Muré <batolettre@gmail.com> | 2021-02-27 20:39:27 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-27 20:39:27 +0100 |
commit | 22cc4cc043370bac945f92ecf343025ce7fdfe33 (patch) | |
tree | a0162d685c22d274dd4e5916d8cf46136c7dc0ea /query/parser_test.go | |
parent | 10a259b6823e1234e5add1ee62935f259c39f803 (diff) | |
parent | fab626a7a663a8fa6ef27848bb63e91af812ab8c (diff) | |
download | git-bug-22cc4cc043370bac945f92ecf343025ce7fdfe33.tar.gz |
Merge pull request #568 from vmiklos/search-metadata
Add ability to search by arbitrary metadata
Diffstat (limited to 'query/parser_test.go')
-rw-r--r-- | query/parser_test.go | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/query/parser_test.go b/query/parser_test.go index 87dd870a..cef01ffd 100644 --- a/query/parser_test.go +++ b/query/parser_test.go @@ -3,7 +3,7 @@ package query import ( "testing" - "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "github.com/MichaelMure/git-bug/bug" ) @@ -62,6 +62,11 @@ func TestParse(t *testing.T) { }}, {"sort:unknown", nil}, + // KVV + {`metadata:key:"https://www.example.com/"`, &Query{ + Filters: Filters{Metadata: []StringPair{{"key", "https://www.example.com/"}}}, + }}, + // Search {"search", &Query{ Search: []string{"search"}, @@ -90,17 +95,17 @@ func TestParse(t *testing.T) { t.Run(tc.input, func(t *testing.T) { query, err := Parse(tc.input) if tc.output == nil { - assert.Error(t, err) - assert.Nil(t, query) + require.Error(t, err) + require.Nil(t, query) } else { - assert.NoError(t, err) + require.NoError(t, err) if tc.output.OrderBy != 0 { - assert.Equal(t, tc.output.OrderBy, query.OrderBy) + require.Equal(t, tc.output.OrderBy, query.OrderBy) } if tc.output.OrderDirection != 0 { - assert.Equal(t, tc.output.OrderDirection, query.OrderDirection) + require.Equal(t, tc.output.OrderDirection, query.OrderDirection) } - assert.Equal(t, tc.output.Filters, query.Filters) + require.Equal(t, tc.output.Filters, query.Filters) } }) } |