22 lines
331 B
Go
22 lines
331 B
Go
|
package iox_test
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"fmt"
|
||
|
"log"
|
||
|
"strings"
|
||
|
|
||
|
"github.com/ooni/probe-cli/v3/internal/iox"
|
||
|
)
|
||
|
|
||
|
func ExampleReadAllContext() {
|
||
|
r := strings.NewReader("deadbeef")
|
||
|
ctx := context.Background()
|
||
|
out, err := iox.ReadAllContext(ctx, r)
|
||
|
if err != nil {
|
||
|
log.Fatal(err)
|
||
|
}
|
||
|
fmt.Printf("%d\n", len(out))
|
||
|
// Output: 8
|
||
|
}
|