github.com/dcarley/cf-cli@v6.24.1-0.20170220111324-4225ff346898+incompatible/util/sorting/alphabetic_test.go (about) 1 package sorting_test 2 3 import ( 4 "sort" 5 6 . "code.cloudfoundry.org/cli/util/sorting" 7 8 . "github.com/onsi/ginkgo" 9 . "github.com/onsi/gomega" 10 ) 11 12 var _ = Describe("Alphabetic", func() { 13 It("sorts an empty slice", func() { 14 sample := []string{} 15 sort.Sort(Alphabetic(sample)) 16 Expect(sample).To(Equal([]string{})) 17 }) 18 19 It("sorts a slice of size 1", func() { 20 sample := []string{"a"} 21 sort.Sort(Alphabetic(sample)) 22 Expect(sample).To(Equal([]string{"a"})) 23 }) 24 25 It("sorts a duplicates", func() { 26 sample := []string{"blurb", "blurb"} 27 sort.Sort(Alphabetic(sample)) 28 Expect(sample).To(Equal([]string{"blurb", "blurb"})) 29 }) 30 31 It("sorts strings alphabetically regardless of case", func() { 32 sample := []string{ 33 "sister", 34 "Father", 35 "Mother", 36 "brother", 37 "3-twins", 38 } 39 expected := []string{ 40 "3-twins", 41 "brother", 42 "Father", 43 "Mother", 44 "sister", 45 } 46 sort.Sort(Alphabetic(sample)) 47 Expect(sample).To(Equal(expected)) 48 }) 49 })