httpserver: add not_ends_with (#1688)

* de-duplicates code for 'not' ops and replicates 'not' op for ends_with

* fixes incorrect test expectations
This commit is contained in:
Connor S. Parks
2017-05-25 13:01:24 +01:00
committed by Matt Holt
parent 33e1560d53
commit 474f119702
2 changed files with 18 additions and 8 deletions
+6 -3
View File
@@ -38,6 +38,9 @@ func TestConditions(t *testing.T) {
{"bab ends_with bb", false},
{"bab ends_with bab", true},
{"bab ends_with ab", true},
{"bab not_ends_with bb", true},
{"bab not_ends_with ab", false},
{"bab not_ends_with bab", false},
{"a match *", false},
{"a match a", true},
{"a match .*", true},
@@ -224,7 +227,7 @@ func TestSetupIfMatcher(t *testing.T) {
},
{`test {
if goal has go
if cook not_has go
if cook not_has go
}`, false, IfMatcher{
ifs: []ifCond{
{a: "goal", op: "has", b: "go"},
@@ -233,7 +236,7 @@ func TestSetupIfMatcher(t *testing.T) {
}},
{`test {
if goal has go
if cook not_has go
if cook not_has go
if_op and
}`, false, IfMatcher{
ifs: []ifCond{
@@ -243,7 +246,7 @@ func TestSetupIfMatcher(t *testing.T) {
}},
{`test {
if goal has go
if cook not_has go
if cook not_has go
if_op not
}`, true, IfMatcher{},
},