mirror of
https://github.com/redis/go-redis.git
synced 2025-04-17 20:17:02 +03:00
Order slices of strings to be sure what the output of Println in doctests will be. (#3241)
* Sort the slices of strings in doctest to make the output deterministic * fix wording
This commit is contained in:
parent
0e3ea5fd6b
commit
efe0f65bf0
@ -5,6 +5,7 @@ package example_commands_test
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"sort"
|
||||||
|
|
||||||
"github.com/redis/go-redis/v9"
|
"github.com/redis/go-redis/v9"
|
||||||
)
|
)
|
||||||
@ -215,6 +216,9 @@ func ExampleClient_saddsmembers() {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sort the strings in the slice to make sure the output is lexicographical
|
||||||
|
sort.Strings(res10)
|
||||||
|
|
||||||
fmt.Println(res10) // >>> [bike:1 bike:2 bike:3]
|
fmt.Println(res10) // >>> [bike:1 bike:2 bike:3]
|
||||||
// STEP_END
|
// STEP_END
|
||||||
|
|
||||||
@ -294,6 +298,10 @@ func ExampleClient_sdiff() {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Sort the strings in the slice to make sure the output is lexicographical
|
||||||
|
sort.Strings(res13)
|
||||||
|
|
||||||
fmt.Println(res13) // >>> [bike:2 bike:3]
|
fmt.Println(res13) // >>> [bike:2 bike:3]
|
||||||
// STEP_END
|
// STEP_END
|
||||||
|
|
||||||
@ -349,6 +357,9 @@ func ExampleClient_multisets() {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sort the strings in the slice to make sure the output is lexicographical
|
||||||
|
sort.Strings(res15)
|
||||||
|
|
||||||
fmt.Println(res15) // >>> [bike:1 bike:2 bike:3 bike:4]
|
fmt.Println(res15) // >>> [bike:1 bike:2 bike:3 bike:4]
|
||||||
|
|
||||||
res16, err := rdb.SDiff(ctx, "bikes:racing:france", "bikes:racing:usa", "bikes:racing:italy").Result()
|
res16, err := rdb.SDiff(ctx, "bikes:racing:france", "bikes:racing:usa", "bikes:racing:italy").Result()
|
||||||
@ -373,6 +384,9 @@ func ExampleClient_multisets() {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sort the strings in the slice to make sure the output is lexicographical
|
||||||
|
sort.Strings(res18)
|
||||||
|
|
||||||
fmt.Println(res18) // >>> [bike:2 bike:3]
|
fmt.Println(res18) // >>> [bike:2 bike:3]
|
||||||
// STEP_END
|
// STEP_END
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user