github.com/jasonkeene/cli@v6.14.1-0.20160816203908-ca5715166dfb+incompatible/utils/generic/slice_test.go (about)

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