multivalued requirement parser more whitespace tolerant

This commit is contained in:
Meir Fischer
2014-11-23 21:55:34 -05:00
parent 162e4983b9
commit 763e48bc6f
2 changed files with 27 additions and 16 deletions

View File

@@ -309,16 +309,16 @@ func TestSetSelectorParser(t *testing.T) {
Valid bool
}{
{"", &LabelSelector{Requirements: nil}, true, true},
{"x", &LabelSelector{Requirements: []Requirement{
{"\rx", &LabelSelector{Requirements: []Requirement{
getRequirement("x", Exists, nil, t),
}}, true, true},
{"foo in (abc)", &LabelSelector{Requirements: []Requirement{
{"foo in (abc)", &LabelSelector{Requirements: []Requirement{
getRequirement("foo", In, util.NewStringSet("abc"), t),
}}, true, true},
{"x not in (abc)", &LabelSelector{Requirements: []Requirement{
{"x not\n\tin (abc)", &LabelSelector{Requirements: []Requirement{
getRequirement("x", NotIn, util.NewStringSet("abc"), t),
}}, true, true},
{"x not in (abc,def)", &LabelSelector{Requirements: []Requirement{
{"x not in \t (abc,def)", &LabelSelector{Requirements: []Requirement{
getRequirement("x", NotIn, util.NewStringSet("abc", "def"), t),
}}, true, true},
{"x in (abc,def)", &LabelSelector{Requirements: []Requirement{
@@ -342,7 +342,6 @@ func TestSetSelectorParser(t *testing.T) {
}}, false, true},
{"x,,y", nil, true, false},
{",x,y", nil, true, false},
{"x, y", nil, true, false},
{"x nott in (y)", nil, true, false},
{"x not in ( )", nil, true, false},
{"x not in (, a)", nil, true, false},