From 66cbad53a1466a9d072701a9ee7cc9e067fde5c8 Mon Sep 17 00:00:00 2001 From: Dimitrij Denissenko Date: Mon, 9 Feb 2015 08:14:41 +0000 Subject: [PATCH] Minor test improvements --- commands_test.go | 16 ++++++++-------- redis_test.go | 6 ------ 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/commands_test.go b/commands_test.go index c6e71ab..d56518f 100644 --- a/commands_test.go +++ b/commands_test.go @@ -245,7 +245,7 @@ var _ = Describe("Commands", func() { keys := client.Keys("*o*") Expect(keys.Err()).NotTo(HaveOccurred()) - Expect(sortStrings(keys.Val())).To(Equal([]string{"four", "one", "two"})) + Expect(keys.Val()).To(ConsistOf([]string{"four", "one", "two"})) keys = client.Keys("t??") Expect(keys.Err()).NotTo(HaveOccurred()) @@ -253,7 +253,7 @@ var _ = Describe("Commands", func() { keys = client.Keys("*") Expect(keys.Err()).NotTo(HaveOccurred()) - Expect(sortStrings(keys.Val())).To(Equal([]string{"four", "one", "three", "two"})) + Expect(keys.Val()).To(ConsistOf([]string{"four", "one", "three", "two"})) }) It("should Migrate", func() { @@ -1473,7 +1473,7 @@ var _ = Describe("Commands", func() { sMembers := client.SMembers("set") Expect(sMembers.Err()).NotTo(HaveOccurred()) - Expect(sortStrings(sMembers.Val())).To(Equal([]string{"Hello", "World"})) + Expect(sMembers.Val()).To(ConsistOf([]string{"Hello", "World"})) }) It("should SCard", func() { @@ -1507,7 +1507,7 @@ var _ = Describe("Commands", func() { sDiff := client.SDiff("set1", "set2") Expect(sDiff.Err()).NotTo(HaveOccurred()) - Expect(sortStrings(sDiff.Val())).To(Equal([]string{"a", "b"})) + Expect(sDiff.Val()).To(ConsistOf([]string{"a", "b"})) }) It("should SDiffStore", func() { @@ -1531,7 +1531,7 @@ var _ = Describe("Commands", func() { sMembers := client.SMembers("set") Expect(sMembers.Err()).NotTo(HaveOccurred()) - Expect(sortStrings(sMembers.Val())).To(Equal([]string{"a", "b"})) + Expect(sMembers.Val()).To(ConsistOf([]string{"a", "b"})) }) It("should SInter", func() { @@ -1599,7 +1599,7 @@ var _ = Describe("Commands", func() { sMembers := client.SMembers("set") Expect(sMembers.Err()).NotTo(HaveOccurred()) - Expect(sortStrings(sMembers.Val())).To(Equal([]string{"Hello", "World"})) + Expect(sMembers.Val()).To(ConsistOf([]string{"Hello", "World"})) }) It("should SMove", func() { @@ -1621,7 +1621,7 @@ var _ = Describe("Commands", func() { sMembers = client.SMembers("set2") Expect(sMembers.Err()).NotTo(HaveOccurred()) - Expect(sortStrings(sMembers.Val())).To(Equal([]string{"three", "two"})) + Expect(sMembers.Val()).To(ConsistOf([]string{"three", "two"})) }) It("should SPop", func() { @@ -1676,7 +1676,7 @@ var _ = Describe("Commands", func() { sMembers := client.SMembers("set") Expect(sMembers.Err()).NotTo(HaveOccurred()) - Expect(sortStrings(sMembers.Val())).To(ConsistOf([]string{"three", "two"})) + Expect(sMembers.Val()).To(ConsistOf([]string{"three", "two"})) }) It("should SUnion", func() { diff --git a/redis_test.go b/redis_test.go index fde06f7..f9736df 100644 --- a/redis_test.go +++ b/redis_test.go @@ -4,7 +4,6 @@ import ( "net" "os" "os/exec" - "sort" "testing" "time" @@ -125,11 +124,6 @@ func TestGinkgoSuite(t *testing.T) { RunSpecs(t, "gopkg.in/redis.v2") } -func sortStrings(slice []string) []string { - sort.Strings(slice) - return slice -} - func execCmd(name string, args ...string) (*os.Process, error) { cmd := exec.Command(name, args...) if true {