rewrite: treat "if a not_op b" uniformly by negating "op". (#1696)

This commit is contained in:
lbogdan
2017-06-16 01:45:42 +03:00
committed by Matt Holt
parent f4b6f15e07
commit 3e2b1d145a
2 changed files with 35 additions and 58 deletions
+6 -6
View File
@@ -201,7 +201,7 @@ func TestSetupIfMatcher(t *testing.T) {
if a match b
}`, false, IfMatcher{
ifs: []ifCond{
{a: "a", op: "match", b: "b"},
{a: "a", op: "match", b: "b", neg: false},
},
}},
{`test {
@@ -209,7 +209,7 @@ func TestSetupIfMatcher(t *testing.T) {
if_op or
}`, false, IfMatcher{
ifs: []ifCond{
{a: "a", op: "match", b: "b"},
{a: "a", op: "match", b: "b", neg: false},
},
isOr: true,
}},
@@ -230,8 +230,8 @@ func TestSetupIfMatcher(t *testing.T) {
if cook not_has go
}`, false, IfMatcher{
ifs: []ifCond{
{a: "goal", op: "has", b: "go"},
{a: "cook", op: "not_has", b: "go"},
{a: "goal", op: "has", b: "go", neg: false},
{a: "cook", op: "has", b: "go", neg: true},
},
}},
{`test {
@@ -240,8 +240,8 @@ func TestSetupIfMatcher(t *testing.T) {
if_op and
}`, false, IfMatcher{
ifs: []ifCond{
{a: "goal", op: "has", b: "go"},
{a: "cook", op: "not_has", b: "go"},
{a: "goal", op: "has", b: "go", neg: false},
{a: "cook", op: "has", b: "go", neg: true},
},
}},
{`test {