4 . "github.com/onsi/ginkgo"
5 . "github.com/onsi/gomega"
6 . "github.com/onsi/gomega/matchers"
9 var _ = Describe("HaveSuffixMatcher", func() {
10 Context("when actual is a string", func() {
11 It("should match a string suffix", func() {
12 Ω("Ab").Should(HaveSuffix("b"))
13 Ω("A").ShouldNot(HaveSuffix("Ab"))
17 Context("when the matcher is called with multiple arguments", func() {
18 It("should pass the string and arguments to sprintf", func() {
19 Ω("C3PO").Should(HaveSuffix("%dPO", 3))
23 Context("when actual is a stringer", func() {
24 It("should call the stringer and match against the returned string", func() {
25 Ω(&myStringer{a: "Ab"}).Should(HaveSuffix("b"))
29 Context("when actual is neither a string nor a stringer", func() {
30 It("should error", func() {
31 success, err := (&HaveSuffixMatcher{Suffix: "2"}).Match(2)
32 Ω(success).Should(BeFalse())
33 Ω(err).Should(HaveOccurred())