1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-11-30 18:53:30 +00:00
arikawa/api/api_test.go

21 lines
358 B
Go
Raw Normal View History

2020-05-03 21:02:03 +00:00
package api
import (
"context"
"errors"
"testing"
)
func TestContext(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
cancel() // lol
client := NewClient("no. 3-chan").WithContext(ctx)
// This should fail.
_, err := client.Me()
if err == nil || !errors.Is(err, context.Canceled) {
t.Fatal("Unexpected error:", err)
}
}