summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/onsi/gomega/gstruct/pointer_test.go
diff options
context:
space:
mode:
authorRastislav Szabo <raszabo@cisco.com>2017-05-04 11:09:03 +0200
committerRastislav Szabo <raszabo@cisco.com>2017-05-04 11:12:35 +0200
commita101d966133a70b8a76526be25070436d14fcf9f (patch)
tree75e2dbf20de615e58252b780b2ba5baae8fdcf82 /vendor/github.com/onsi/gomega/gstruct/pointer_test.go
parenta968ead74525125dff9ae90b1c9a9102e4327900 (diff)
initial commit
Signed-off-by: Rastislav Szabo <raszabo@cisco.com>
Diffstat (limited to 'vendor/github.com/onsi/gomega/gstruct/pointer_test.go')
-rw-r--r--vendor/github.com/onsi/gomega/gstruct/pointer_test.go33
1 files changed, 33 insertions, 0 deletions
diff --git a/vendor/github.com/onsi/gomega/gstruct/pointer_test.go b/vendor/github.com/onsi/gomega/gstruct/pointer_test.go
new file mode 100644
index 0000000..b02081c
--- /dev/null
+++ b/vendor/github.com/onsi/gomega/gstruct/pointer_test.go
@@ -0,0 +1,33 @@
+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{}
+ Ω(p).Should(BeNil())
+ })
+
+ It("should succeed when passed non-nil pointer", func() {
+ var s struct{}
+ Ω(&s).Should(PointTo(Ignore()))
+ })
+
+ It("should unwrap the pointee value", func() {
+ i := 1
+ Ω(&i).Should(PointTo(Equal(1)))
+ Ω(&i).ShouldNot(PointTo(Equal(2)))
+ })
+
+ It("should work with nested pointers", func() {
+ i := 1
+ ip := &i
+ ipp := &ip
+ Ω(ipp).Should(PointTo(PointTo(Equal(1))))
+ Ω(ipp).ShouldNot(PointTo(PointTo(Equal(2))))
+ })
+})