github.com/lukasheimann/cloudfoundrycli@v7.1.0+incompatible/util/generic/slice_test.go (about)

     1  package generic_test
     2  
     3  import (
     4  	"code.cloudfoundry.org/cli/util/generic"
     5  	. "github.com/onsi/ginkgo"
     6  	. "github.com/onsi/gomega"
     7  )
     8  
     9  var _ = Describe("IsSliceable", func() {
    10  	It("returns false if the type is nil", func() {
    11  		Expect(generic.IsSliceable(nil)).To(BeFalse())
    12  	})
    13  
    14  	It("should return false when the type cannot be sliced", func() {
    15  		Expect(generic.IsSliceable("bad slicing")).To(BeFalse())
    16  	})
    17  
    18  	It("should return true if the type can be sliced", func() {
    19  		Expect(generic.IsSliceable([]string{"a string"})).To(BeTrue())
    20  	})
    21  
    22  	It("should return true if the type can be sliced", func() {
    23  		Expect(generic.IsSliceable([]interface{}{1, 2, 3})).To(BeTrue())
    24  	})
    25  })