filters: clean up implementation

Address a few cleanup items in the parser. Currently, we don't handle
compound values and we remove a panic when part of the input is not
consumed.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
Stephen J Day
2017-06-20 17:50:06 -07:00
parent 80656bf8ca
commit 3d5ee9e8b8
4 changed files with 49 additions and 33 deletions

View File

@@ -56,6 +56,12 @@ func TestFilters(t *testing.T) {
Name: "bazo",
Other: "abc",
},
{
Name: "compound",
Labels: map[string]string{
"foo": "omg_asdf.asdf-qwer",
},
},
}
var corpus []interface{}
@@ -103,6 +109,7 @@ func TestFilters(t *testing.T) {
expected: []interface{}{
corpus[0],
corpus[2],
corpus[8],
},
},
{
@@ -112,6 +119,13 @@ func TestFilters(t *testing.T) {
corpus[0],
},
},
{
name: "LabelValuePunctuated",
input: "labels.foo==omg_asdf.asdf-qwer",
expected: []interface{}{
corpus[8],
},
},
{
name: "Name",
input: "name==bar",
@@ -130,6 +144,7 @@ func TestFilters(t *testing.T) {
corpus[5],
corpus[6],
corpus[7],
corpus[8],
},
},
{