Skip to content

Commit

Permalink
Minor test improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
dim committed Feb 9, 2015
1 parent f9d3077 commit 66cbad5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
16 changes: 8 additions & 8 deletions commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,15 +245,15 @@ 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())
Expect(keys.Val()).To(Equal([]string{"two"}))

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() {
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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() {
Expand All @@ -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() {
Expand Down Expand Up @@ -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() {
Expand All @@ -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() {
Expand Down Expand Up @@ -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() {
Expand Down
6 changes: 0 additions & 6 deletions redis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"net"
"os"
"os/exec"
"sort"
"testing"
"time"

Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 66cbad5

Please sign in to comment.