initial commit
[govpp.git] / vendor / github.com / onsi / gomega / matchers / assignable_to_type_of_matcher_test.go
1 package matchers_test
2
3 import (
4         . "github.com/onsi/ginkgo"
5         . "github.com/onsi/gomega"
6         . "github.com/onsi/gomega/matchers"
7 )
8
9 var _ = Describe("AssignableToTypeOf", func() {
10         Context("When asserting assignability between types", func() {
11                 It("should do the right thing", func() {
12                         Ω(0).Should(BeAssignableToTypeOf(0))
13                         Ω(5).Should(BeAssignableToTypeOf(-1))
14                         Ω("foo").Should(BeAssignableToTypeOf("bar"))
15                         Ω(struct{ Foo string }{}).Should(BeAssignableToTypeOf(struct{ Foo string }{}))
16
17                         Ω(0).ShouldNot(BeAssignableToTypeOf("bar"))
18                         Ω(5).ShouldNot(BeAssignableToTypeOf(struct{ Foo string }{}))
19                         Ω("foo").ShouldNot(BeAssignableToTypeOf(42))
20                 })
21         })
22
23         Context("When asserting nil values", func() {
24                 It("should error", func() {
25                         success, err := (&AssignableToTypeOfMatcher{Expected: nil}).Match(nil)
26                         Ω(success).Should(BeFalse())
27                         Ω(err).Should(HaveOccurred())
28                 })
29         })
30 })