spiegel_podman/vendor/github.com/onsi/gomega/gstruct/pointer_test.go
Valentin Rothberg 9ac0ebb079 Cirrus: add vendor_check_task
* Make sure that all vendored dependencies are in sync with the code and
  the vendor.conf by running `make vendor` with a follow-up status check
  of the git tree.

* Vendor ginkgo and gomega to include the test dependencies.

Signed-off-by: Chris Evic <cevich@redhat.com>
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-02-06 11:14:06 +01:00

33 lines
711 B
Go

package gstruct_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gstruct"
)
var _ = Describe("PointTo", func() {
It("should fail when passed nil", func() {
var p *struct{}
Expect(p).Should(BeNil())
})
It("should succeed when passed non-nil pointer", func() {
var s struct{}
Expect(&s).Should(PointTo(Ignore()))
})
It("should unwrap the pointee value", func() {
i := 1
Expect(&i).Should(PointTo(Equal(1)))
Expect(&i).ShouldNot(PointTo(Equal(2)))
})
It("should work with nested pointers", func() {
i := 1
ip := &i
ipp := &ip
Expect(ipp).Should(PointTo(PointTo(Equal(1))))
Expect(ipp).ShouldNot(PointTo(PointTo(Equal(2))))
})
})