Skip to content

Commit 8333a8f

Browse files
DOC-5743 combine examples into one function
1 parent d504232 commit 8333a8f

File tree

1 file changed

+4
-36
lines changed

1 file changed

+4
-36
lines changed

doctests/bitmap_tutorial_test.go

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ func ExampleClient_bitcount() {
9595
// 1
9696
}
9797

98-
func ExampleClient_bitop_setup() {
98+
func ExampleClient_bitops() {
9999
ctx := context.Background()
100100

101101
rdb := redis.NewClient(&redis.Options{
@@ -135,41 +135,6 @@ func ExampleClient_bitop_setup() {
135135
// >>> 01101100
136136
// STEP_END
137137

138-
// Output:
139-
// 11011000
140-
// 00011001
141-
// 01101100
142-
}
143-
144-
func ExampleClient_bitop_ops() {
145-
ctx := context.Background()
146-
147-
rdb := redis.NewClient(&redis.Options{
148-
Addr: "localhost:6379",
149-
Password: "", // no password docs
150-
DB: 0, // use default DB
151-
})
152-
153-
// REMOVE_START
154-
// start with fresh database
155-
rdb.FlushDB(ctx)
156-
rdb.Del(ctx, "A", "B", "C", "R")
157-
// REMOVE_END
158-
159-
// HIDE_START
160-
rdb.SetBit(ctx, "A", 0, 1)
161-
rdb.SetBit(ctx, "A", 1, 1)
162-
rdb.SetBit(ctx, "A", 3, 1)
163-
rdb.SetBit(ctx, "A", 4, 1)
164-
rdb.SetBit(ctx, "B", 3, 1)
165-
rdb.SetBit(ctx, "B", 4, 1)
166-
rdb.SetBit(ctx, "B", 7, 1)
167-
rdb.SetBit(ctx, "C", 1, 1)
168-
rdb.SetBit(ctx, "C", 2, 1)
169-
rdb.SetBit(ctx, "C", 4, 1)
170-
rdb.SetBit(ctx, "C", 5, 1)
171-
// HIDE_END
172-
173138
// STEP_START bitop_and
174139
rdb.BitOpAnd(ctx, "R", "A", "B", "C")
175140
br, _ := rdb.Get(ctx, "R").Bytes()
@@ -227,6 +192,9 @@ func ExampleClient_bitop_ops() {
227192
// STEP_END
228193

229194
// Output:
195+
// 11011000
196+
// 00011001
197+
// 01101100
230198
// 00001000
231199
// 11111101
232200
// 11000001

0 commit comments

Comments
 (0)