github.com/cloudfoundry/cli@v7.1.0+incompatible/cf/uihelpers/tags_parser_test.go (about) 1 package uihelpers_test 2 3 import ( 4 . "code.cloudfoundry.org/cli/cf/uihelpers" 5 . "github.com/onsi/ginkgo" 6 . "github.com/onsi/gomega" 7 ) 8 9 var _ = Describe("tags parser", func() { 10 11 It("parses an empty string", func() { 12 rawTag := "" 13 14 Expect(ParseTags(rawTag)).To(Equal([]string{})) 15 }) 16 17 It("parses a single tag string", func() { 18 rawTag := "a, b, c, d" 19 20 Expect(ParseTags(rawTag)).To(Equal([]string{"a", "b", "c", "d"})) 21 }) 22 23 Context("and the formatting isn't a perfect comma-delimited list", func() { 24 25 It("parses a single tag string", func() { 26 rawTag := "a,b, c,d" 27 28 Expect(ParseTags(rawTag)).To(Equal([]string{"a", "b", "c", "d"})) 29 }) 30 31 It("parses a single tag string", func() { 32 rawTag := " a, b, c, d " 33 34 Expect(ParseTags(rawTag)).To(Equal([]string{"a", "b", "c", "d"})) 35 }) 36 37 It("parses a single tag string", func() { 38 rawTag := "a" 39 40 Expect(ParseTags(rawTag)).To(Equal([]string{"a"})) 41 }) 42 43 It("parses a single tag string", func() { 44 rawTag := ",,,,,a,,,,,b" 45 46 Expect(ParseTags(rawTag)).To(Equal([]string{"a", "b"})) 47 }) 48 49 It("parses a single tag string", func() { 50 rawTag := "a, , , b" 51 52 Expect(ParseTags(rawTag)).To(Equal([]string{"a", "b"})) 53 }) 54 }) 55 })