Remove 'go' from calling 'cancel'

https://github.com/mattn/go-mastodon/pull/28#discussion_r112162740
This commit is contained in:
TSUYUSATO Kitsune 2017-04-19 19:12:09 +09:00
parent fb53d41dd9
commit b105e8554c
2 changed files with 4 additions and 4 deletions

View File

@ -52,7 +52,7 @@ func TestRegisterAppWithCancel(t *testing.T) {
defer ts.Close()
ctx, cancel := context.WithCancel(context.Background())
go cancel()
cancel()
_, err := RegisterApp(ctx, &AppConfig{
Server: ts.URL,
Scopes: "read write follow",

View File

@ -56,7 +56,7 @@ func TestAuthenticateWithCancel(t *testing.T) {
ClientSecret: "bar",
})
ctx, cancel := context.WithCancel(context.Background())
go cancel()
cancel()
err := client.Authenticate(ctx, "invalid", "user")
if err == nil {
t.Fatalf("should be fail: %v", err)
@ -116,7 +116,7 @@ func TestPostStatusWithCancel(t *testing.T) {
ClientSecret: "bar",
})
ctx, cancel := context.WithCancel(context.Background())
go cancel()
cancel()
_, err := client.PostStatus(ctx, &Toot{
Status: "foobar",
})
@ -182,7 +182,7 @@ func TestGetTimelineHomeWithCancel(t *testing.T) {
AccessToken: "zoo",
})
ctx, cancel := context.WithCancel(context.Background())
go cancel()
cancel()
_, err := client.GetTimelineHome(ctx)
if err == nil {
t.Fatalf("should be fail: %v", err)