github.com/rakutentech/cli@v6.12.5-0.20151006231303-24468b65536e+incompatible/generic/slice_test.go (about)

     1  package generic_test
     2  
     3  import (
     4  	"github.com/cloudfoundry/cli/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  }