...

Source file src/github.com/onsi/gomega/matchers/be_nil_matcher_test.go

Documentation: github.com/onsi/gomega/matchers

     1  package matchers_test
     2  
     3  import (
     4  	. "github.com/onsi/ginkgo/v2"
     5  	. "github.com/onsi/gomega"
     6  )
     7  
     8  var _ = Describe("BeNil", func() {
     9  	It("should succeed when passed nil", func() {
    10  		Expect(nil).Should(BeNil())
    11  	})
    12  
    13  	It("should succeed when passed a typed nil", func() {
    14  		var a []int
    15  		Expect(a).Should(BeNil())
    16  	})
    17  
    18  	It("should succeed when passing nil pointer", func() {
    19  		var f *struct{}
    20  		Expect(f).Should(BeNil())
    21  	})
    22  
    23  	It("should not succeed when not passed nil", func() {
    24  		Expect(0).ShouldNot(BeNil())
    25  		Expect(false).ShouldNot(BeNil())
    26  		Expect("").ShouldNot(BeNil())
    27  	})
    28  })
    29  

View as plain text