add SatisfyAll() and SatisfyAny() as aliases for And() and Or(), respectively
diff --git a/matchers.go b/matchers.go
index ba41103..4bdc588 100644
--- a/matchers.go
+++ b/matchers.go
@@ -353,6 +353,12 @@
return &matchers.AndMatcher{Matchers: ms}
}
+//SatisfyAll is an alias for And().
+// Ω(foo).Should(SatisfyAll(ContainElement("bar"), HaveLen(3)))
+func SatisfyAll(matchers ...types.GomegaMatcher) types.GomegaMatcher {
+ return And(matchers...)
+}
+
//Or succeeds if any of the given matchers succeed.
//The matchers are tried in order and will return immediately upon the first successful match.
// Expect("hi").To(Or(HaveLen(3), HaveLen(2))
@@ -362,6 +368,12 @@
return &matchers.OrMatcher{Matchers: ms}
}
+//SatisfyAny is an alias for Or().
+// Expect(foo).To(SatisfyAny(ContainElement("bar"), HaveLen(3)))
+func SatisfyAny(matchers ...types.GomegaMatcher) types.GomegaMatcher {
+ return Or(matchers...)
+}
+
//Not negates the given matcher; it succeeds if the given matcher fails.
// Expect(1).To(Not(Equal(2))
//
diff --git a/matchers/and_test.go b/matchers/and_test.go
index c50e800..955e4ae 100644
--- a/matchers/and_test.go
+++ b/matchers/and_test.go
@@ -33,6 +33,9 @@
Expect(input).To(And(true1))
Expect(input).To(And(true1, true2))
Expect(input).To(And(true1, true2, true3))
+
+ // use alias
+ Expect(input).To(SatisfyAll(true1, true2, true3))
})
It("works with negative cases", func() {
diff --git a/matchers/or_test.go b/matchers/or_test.go
index ae6f975..d9c7b82 100644
--- a/matchers/or_test.go
+++ b/matchers/or_test.go
@@ -17,6 +17,9 @@
Expect(input).To(Or(false1, true2, true3))
Expect(input).To(Or(true1, false2, false3))
Expect(input).To(Or(false1, false2, true3))
+
+ // use alias
+ Expect(input).To(SatisfyAny(false1, false2, true3))
})
It("works with negative cases", func() {