aboutsummaryrefslogtreecommitdiffstats
path: root/query/parser_test.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2021-02-27 20:39:27 +0100
committerGitHub <noreply@github.com>2021-02-27 20:39:27 +0100
commit22cc4cc043370bac945f92ecf343025ce7fdfe33 (patch)
treea0162d685c22d274dd4e5916d8cf46136c7dc0ea /query/parser_test.go
parent10a259b6823e1234e5add1ee62935f259c39f803 (diff)
parentfab626a7a663a8fa6ef27848bb63e91af812ab8c (diff)
downloadgit-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.go19
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)
}
})
}