Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Order slices of strings to be sure what the output of Println in doctests will be. #3241

Merged
merged 2 commits into from
Jan 20, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions doctests/sets_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package example_commands_test
import (
"context"
"fmt"
"sort"

"github.com/redis/go-redis/v9"
)
Expand Down Expand Up @@ -215,6 +216,9 @@ func ExampleClient_saddsmembers() {
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]
// STEP_END

Expand Down Expand Up @@ -294,6 +298,10 @@ func ExampleClient_sdiff() {
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]
// STEP_END

Expand Down Expand Up @@ -349,6 +357,9 @@ func ExampleClient_multisets() {
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]

res16, err := rdb.SDiff(ctx, "bikes:racing:france", "bikes:racing:usa", "bikes:racing:italy").Result()
Expand All @@ -373,6 +384,9 @@ func ExampleClient_multisets() {
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]
// STEP_END

Expand Down
Loading