remove redundent return statements

pull/156/head
Darren O'Connor 2022-11-16 01:43:29 +00:00 committed by mattn
parent f76d33a68c
commit 9e1af56ceb
7 changed files with 0 additions and 59 deletions

View File

@ -118,7 +118,6 @@ func TestGetAccountStatuses(t *testing.T) {
return return
} }
fmt.Fprintln(w, `[{"content": "foo"}, {"content": "bar"}]`) fmt.Fprintln(w, `[{"content": "foo"}, {"content": "bar"}]`)
return
})) }))
defer ts.Close() defer ts.Close()
@ -156,7 +155,6 @@ func TestGetAccountPinnedStatuses(t *testing.T) {
return return
} }
fmt.Fprintln(w, `[{"content": "foo"}, {"content": "bar"}]`) fmt.Fprintln(w, `[{"content": "foo"}, {"content": "bar"}]`)
return
})) }))
defer ts.Close() defer ts.Close()
@ -189,7 +187,6 @@ func TestGetAccountFollowers(t *testing.T) {
return return
} }
fmt.Fprintln(w, `[{"username": "foo"}, {"username": "bar"}]`) fmt.Fprintln(w, `[{"username": "foo"}, {"username": "bar"}]`)
return
})) }))
defer ts.Close() defer ts.Close()
@ -225,7 +222,6 @@ func TestGetAccountFollowing(t *testing.T) {
return return
} }
fmt.Fprintln(w, `[{"username": "foo"}, {"username": "bar"}]`) fmt.Fprintln(w, `[{"username": "foo"}, {"username": "bar"}]`)
return
})) }))
defer ts.Close() defer ts.Close()
@ -263,7 +259,6 @@ func TestGetBlocks(t *testing.T) {
return return
} }
fmt.Fprintln(w, `[{"username": "foo"}, {"username": "bar"}]`) fmt.Fprintln(w, `[{"username": "foo"}, {"username": "bar"}]`)
return
})) }))
defer ts.Close() defer ts.Close()
@ -299,7 +294,6 @@ func TestAccountFollow(t *testing.T) {
return return
} }
fmt.Fprintln(w, `{"id":1234567,"following":true}`) fmt.Fprintln(w, `{"id":1234567,"following":true}`)
return
})) }))
defer ts.Close() defer ts.Close()
@ -332,7 +326,6 @@ func TestAccountUnfollow(t *testing.T) {
return return
} }
fmt.Fprintln(w, `{"id":1234567,"following":false}`) fmt.Fprintln(w, `{"id":1234567,"following":false}`)
return
})) }))
defer ts.Close() defer ts.Close()
@ -365,7 +358,6 @@ func TestAccountBlock(t *testing.T) {
return return
} }
fmt.Fprintln(w, `{"id":1234567,"blocking":true}`) fmt.Fprintln(w, `{"id":1234567,"blocking":true}`)
return
})) }))
defer ts.Close() defer ts.Close()
@ -398,7 +390,6 @@ func TestAccountUnblock(t *testing.T) {
return return
} }
fmt.Fprintln(w, `{"id":1234567,"blocking":false}`) fmt.Fprintln(w, `{"id":1234567,"blocking":false}`)
return
})) }))
defer ts.Close() defer ts.Close()
@ -431,7 +422,6 @@ func TestAccountMute(t *testing.T) {
return return
} }
fmt.Fprintln(w, `{"id":1234567,"muting":true}`) fmt.Fprintln(w, `{"id":1234567,"muting":true}`)
return
})) }))
defer ts.Close() defer ts.Close()
@ -464,7 +454,6 @@ func TestAccountUnmute(t *testing.T) {
return return
} }
fmt.Fprintln(w, `{"id":1234567,"muting":false}`) fmt.Fprintln(w, `{"id":1234567,"muting":false}`)
return
})) }))
defer ts.Close() defer ts.Close()
@ -530,7 +519,6 @@ func TestAccountsSearch(t *testing.T) {
return return
} }
fmt.Fprintln(w, `[{"username": "foobar"}, {"username": "barfoo"}]`) fmt.Fprintln(w, `[{"username": "foobar"}, {"username": "barfoo"}]`)
return
})) }))
defer ts.Close() defer ts.Close()
@ -566,7 +554,6 @@ func TestFollowRemoteUser(t *testing.T) {
return return
} }
fmt.Fprintln(w, `{"username": "zzz"}`) fmt.Fprintln(w, `{"username": "zzz"}`)
return
})) }))
defer ts.Close() defer ts.Close()
@ -598,7 +585,6 @@ func TestGetFollowRequests(t *testing.T) {
return return
} }
fmt.Fprintln(w, `[{"username": "foo"}, {"username": "bar"}]`) fmt.Fprintln(w, `[{"username": "foo"}, {"username": "bar"}]`)
return
})) }))
defer ts.Close() defer ts.Close()
@ -684,7 +670,6 @@ func TestGetMutes(t *testing.T) {
return return
} }
fmt.Fprintln(w, `[{"username": "foo"}, {"username": "bar"}]`) fmt.Fprintln(w, `[{"username": "foo"}, {"username": "bar"}]`)
return
})) }))
defer ts.Close() defer ts.Close()

View File

@ -27,7 +27,6 @@ func TestRegisterApp(t *testing.T) {
return return
} }
fmt.Fprintln(w, `{"id": 123, "client_id": "foo", "client_secret": "bar"}`) fmt.Fprintln(w, `{"id": 123, "client_id": "foo", "client_secret": "bar"}`)
return
})) }))
defer ts.Close() defer ts.Close()
@ -79,7 +78,6 @@ func TestRegisterAppWithCancel(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
time.Sleep(3 * time.Second) time.Sleep(3 * time.Second)
fmt.Fprintln(w, `{"client_id": "foo", "client_secret": "bar"}`) fmt.Fprintln(w, `{"client_id": "foo", "client_secret": "bar"}`)
return
})) }))
defer ts.Close() defer ts.Close()

View File

@ -15,7 +15,6 @@ func TestGetLists(t *testing.T) {
return return
} }
fmt.Fprintln(w, `[{"id": "1", "title": "foo"}, {"id": "2", "title": "bar"}]`) fmt.Fprintln(w, `[{"id": "1", "title": "foo"}, {"id": "2", "title": "bar"}]`)
return
})) }))
defer ts.Close() defer ts.Close()
@ -47,7 +46,6 @@ func TestGetAccountLists(t *testing.T) {
return return
} }
fmt.Fprintln(w, `[{"id": "1", "title": "foo"}, {"id": "2", "title": "bar"}]`) fmt.Fprintln(w, `[{"id": "1", "title": "foo"}, {"id": "2", "title": "bar"}]`)
return
})) }))
defer ts.Close() defer ts.Close()
@ -83,7 +81,6 @@ func TestGetListAccounts(t *testing.T) {
return return
} }
fmt.Fprintln(w, `[{"username": "foo"}, {"username": "bar"}]`) fmt.Fprintln(w, `[{"username": "foo"}, {"username": "bar"}]`)
return
})) }))
defer ts.Close() defer ts.Close()
@ -119,7 +116,6 @@ func TestGetList(t *testing.T) {
return return
} }
fmt.Fprintln(w, `{"id": "1", "title": "foo"}`) fmt.Fprintln(w, `{"id": "1", "title": "foo"}`)
return
})) }))
defer ts.Close() defer ts.Close()
@ -149,7 +145,6 @@ func TestCreateList(t *testing.T) {
return return
} }
fmt.Fprintln(w, `{"id": "1", "title": "foo"}`) fmt.Fprintln(w, `{"id": "1", "title": "foo"}`)
return
})) }))
defer ts.Close() defer ts.Close()
@ -183,7 +178,6 @@ func TestRenameList(t *testing.T) {
return return
} }
fmt.Fprintln(w, `{"id": "1", "title": "bar"}`) fmt.Fprintln(w, `{"id": "1", "title": "bar"}`)
return
})) }))
defer ts.Close() defer ts.Close()
@ -216,7 +210,6 @@ func TestDeleteList(t *testing.T) {
http.Error(w, http.StatusText(http.StatusNotFound), http.StatusMethodNotAllowed) http.Error(w, http.StatusText(http.StatusNotFound), http.StatusMethodNotAllowed)
return return
} }
return
})) }))
defer ts.Close() defer ts.Close()
@ -246,7 +239,6 @@ func TestAddToList(t *testing.T) {
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError) http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
return return
} }
return
})) }))
defer ts.Close() defer ts.Close()
@ -272,7 +264,6 @@ func TestRemoveFromList(t *testing.T) {
http.Error(w, http.StatusText(http.StatusNotFound), http.StatusMethodNotAllowed) http.Error(w, http.StatusText(http.StatusNotFound), http.StatusMethodNotAllowed)
return return
} }
return
})) }))
defer ts.Close() defer ts.Close()

View File

@ -96,7 +96,6 @@ func TestAuthenticate(t *testing.T) {
return return
} }
fmt.Fprintln(w, `{"access_token": "zoo"}`) fmt.Fprintln(w, `{"access_token": "zoo"}`)
return
})) }))
defer ts.Close() defer ts.Close()
@ -124,7 +123,6 @@ func TestAuthenticate(t *testing.T) {
func TestAuthenticateWithCancel(t *testing.T) { func TestAuthenticateWithCancel(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
time.Sleep(3 * time.Second) time.Sleep(3 * time.Second)
return
})) }))
defer ts.Close() defer ts.Close()
@ -151,7 +149,6 @@ func TestAuthenticateApp(t *testing.T) {
return return
} }
fmt.Fprintln(w, `{"name":"zzz","website":"yyy","vapid_key":"xxx"}`) fmt.Fprintln(w, `{"name":"zzz","website":"yyy","vapid_key":"xxx"}`)
return
})) }))
defer ts.Close() defer ts.Close()
@ -183,7 +180,6 @@ func TestPostStatus(t *testing.T) {
return return
} }
fmt.Fprintln(w, `{"access_token": "zoo"}`) fmt.Fprintln(w, `{"access_token": "zoo"}`)
return
})) }))
defer ts.Close() defer ts.Close()
@ -216,7 +212,6 @@ func TestPostStatus(t *testing.T) {
func TestPostStatusWithCancel(t *testing.T) { func TestPostStatusWithCancel(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
time.Sleep(3 * time.Second) time.Sleep(3 * time.Second)
return
})) }))
defer ts.Close() defer ts.Close()
@ -351,7 +346,6 @@ func TestPostStatusParams(t *testing.T) {
func TestGetTimelineHome(t *testing.T) { func TestGetTimelineHome(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, `[{"content": "foo"}, {"content": "bar"}]`) fmt.Fprintln(w, `[{"content": "foo"}, {"content": "bar"}]`)
return
})) }))
defer ts.Close() defer ts.Close()
@ -391,7 +385,6 @@ func TestGetTimelineHome(t *testing.T) {
func TestGetTimelineHomeWithCancel(t *testing.T) { func TestGetTimelineHomeWithCancel(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
time.Sleep(3 * time.Second) time.Sleep(3 * time.Second)
return
})) }))
defer ts.Close() defer ts.Close()

View File

@ -28,7 +28,6 @@ func TestGetNotifications(t *testing.T) {
return return
} }
http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound) http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
return
})) }))
defer ts.Close() defer ts.Close()
@ -76,7 +75,6 @@ func TestPushSubscription(t *testing.T) {
return return
} }
http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound) http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
return
})) }))
defer ts.Close() defer ts.Close()

View File

@ -15,7 +15,6 @@ func TestGetReports(t *testing.T) {
return return
} }
fmt.Fprintln(w, `[{"id": 122, "action_taken": false}, {"id": 123, "action_taken": true}]`) fmt.Fprintln(w, `[{"id": 122, "action_taken": false}, {"id": 123, "action_taken": true}]`)
return
})) }))
defer ts.Close() defer ts.Close()
@ -55,7 +54,6 @@ func TestReport(t *testing.T) {
} else { } else {
fmt.Fprintln(w, `{"id": 1234, "action_taken": true}`) fmt.Fprintln(w, `{"id": 1234, "action_taken": true}`)
} }
return
})) }))
defer ts.Close() defer ts.Close()

View File

@ -13,7 +13,6 @@ import (
func TestGetFavourites(t *testing.T) { func TestGetFavourites(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, `[{"content": "foo"}, {"content": "bar"}]`) fmt.Fprintln(w, `[{"content": "foo"}, {"content": "bar"}]`)
return
})) }))
defer ts.Close() defer ts.Close()
@ -41,7 +40,6 @@ func TestGetFavourites(t *testing.T) {
func TestGetBookmarks(t *testing.T) { func TestGetBookmarks(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, `[{"content": "foo"}, {"content": "bar"}]`) fmt.Fprintln(w, `[{"content": "foo"}, {"content": "bar"}]`)
return
})) }))
defer ts.Close() defer ts.Close()
@ -73,7 +71,6 @@ func TestGetStatus(t *testing.T) {
return return
} }
fmt.Fprintln(w, `{"content": "zzz", "emojis":[{"shortcode":"💩", "url":"http://example.com", "static_url": "http://example.com/static"}]}`) fmt.Fprintln(w, `{"content": "zzz", "emojis":[{"shortcode":"💩", "url":"http://example.com", "static_url": "http://example.com/static"}]}`)
return
})) }))
defer ts.Close() defer ts.Close()
@ -115,7 +112,6 @@ func TestGetStatusCard(t *testing.T) {
return return
} }
fmt.Fprintln(w, `{"title": "zzz"}`) fmt.Fprintln(w, `{"title": "zzz"}`)
return
})) }))
defer ts.Close() defer ts.Close()
@ -145,7 +141,6 @@ func TestGetStatusContext(t *testing.T) {
return return
} }
fmt.Fprintln(w, `{"ancestors": [{"content": "zzz"},{"content": "bbb"}]}`) fmt.Fprintln(w, `{"ancestors": [{"content": "zzz"},{"content": "bbb"}]}`)
return
})) }))
defer ts.Close() defer ts.Close()
@ -184,7 +179,6 @@ func TestGetRebloggedBy(t *testing.T) {
return return
} }
fmt.Fprintln(w, `[{"username": "foo"}, {"username": "bar"}]`) fmt.Fprintln(w, `[{"username": "foo"}, {"username": "bar"}]`)
return
})) }))
defer ts.Close() defer ts.Close()
@ -220,7 +214,6 @@ func TestGetFavouritedBy(t *testing.T) {
return return
} }
fmt.Fprintln(w, `[{"username": "foo"}, {"username": "bar"}]`) fmt.Fprintln(w, `[{"username": "foo"}, {"username": "bar"}]`)
return
})) }))
defer ts.Close() defer ts.Close()
@ -256,7 +249,6 @@ func TestReblog(t *testing.T) {
return return
} }
fmt.Fprintln(w, `{"content": "zzz"}`) fmt.Fprintln(w, `{"content": "zzz"}`)
return
})) }))
defer ts.Close() defer ts.Close()
@ -286,7 +278,6 @@ func TestUnreblog(t *testing.T) {
return return
} }
fmt.Fprintln(w, `{"content": "zzz"}`) fmt.Fprintln(w, `{"content": "zzz"}`)
return
})) }))
defer ts.Close() defer ts.Close()
@ -316,7 +307,6 @@ func TestFavourite(t *testing.T) {
return return
} }
fmt.Fprintln(w, `{"content": "zzz"}`) fmt.Fprintln(w, `{"content": "zzz"}`)
return
})) }))
defer ts.Close() defer ts.Close()
@ -346,7 +336,6 @@ func TestUnfavourite(t *testing.T) {
return return
} }
fmt.Fprintln(w, `{"content": "zzz"}`) fmt.Fprintln(w, `{"content": "zzz"}`)
return
})) }))
defer ts.Close() defer ts.Close()
@ -376,7 +365,6 @@ func TestBookmark(t *testing.T) {
return return
} }
fmt.Fprintln(w, `{"content": "zzz"}`) fmt.Fprintln(w, `{"content": "zzz"}`)
return
})) }))
defer ts.Close() defer ts.Close()
@ -406,7 +394,6 @@ func TestUnbookmark(t *testing.T) {
return return
} }
fmt.Fprintln(w, `{"content": "zzz"}`) fmt.Fprintln(w, `{"content": "zzz"}`)
return
})) }))
defer ts.Close() defer ts.Close()
@ -488,7 +475,6 @@ func TestGetTimelineHashtag(t *testing.T) {
return return
} }
fmt.Fprintln(w, `[{"content": "zzz"},{"content": "yyy"}]`) fmt.Fprintln(w, `[{"content": "zzz"},{"content": "yyy"}]`)
return
})) }))
defer ts.Close() defer ts.Close()
@ -524,7 +510,6 @@ func TestGetTimelineList(t *testing.T) {
return return
} }
fmt.Fprintln(w, `[{"content": "zzz"},{"content": "yyy"}]`) fmt.Fprintln(w, `[{"content": "zzz"},{"content": "yyy"}]`)
return
})) }))
defer ts.Close() defer ts.Close()
@ -560,7 +545,6 @@ func TestGetTimelineMedia(t *testing.T) {
return return
} }
fmt.Fprintln(w, `[{"content": "zzz"},{"content": "yyy"}]`) fmt.Fprintln(w, `[{"content": "zzz"},{"content": "yyy"}]`)
return
})) }))
defer ts.Close() defer ts.Close()
@ -599,7 +583,6 @@ func TestDeleteStatus(t *testing.T) {
http.Error(w, http.StatusText(http.StatusNotFound), http.StatusMethodNotAllowed) http.Error(w, http.StatusText(http.StatusNotFound), http.StatusMethodNotAllowed)
return return
} }
return
})) }))
defer ts.Close() defer ts.Close()
@ -635,7 +618,6 @@ func TestSearch(t *testing.T) {
"statuses":[{"content": "aaa"}], "statuses":[{"content": "aaa"}],
"hashtags":[{"name": "tag"},{"name": "tag2"},{"name": "tag3"}] "hashtags":[{"name": "tag"},{"name": "tag2"},{"name": "tag3"}]
}`) }`)
return
})) }))
defer ts.Close() defer ts.Close()
@ -680,7 +662,6 @@ func TestUploadMedia(t *testing.T) {
return return
} }
fmt.Fprintln(w, `{"id": 123}`) fmt.Fprintln(w, `{"id": 123}`)
return
})) }))
defer ts.Close() defer ts.Close()
@ -729,7 +710,6 @@ func TestGetConversations(t *testing.T) {
http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound) http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
} }
fmt.Fprintln(w, `[{"id": "4", "unread":false, "last_status" : {"content": "zzz"}}, {"id": "3", "unread":true, "last_status" : {"content": "bar"}}]`) fmt.Fprintln(w, `[{"id": "4", "unread":false, "last_status" : {"content": "zzz"}}, {"id": "3", "unread":true, "last_status" : {"content": "bar"}}]`)
return
})) }))
defer ts.Close() defer ts.Close()
@ -767,7 +747,6 @@ func TestDeleteConversation(t *testing.T) {
http.Error(w, http.StatusText(http.StatusNotFound), http.StatusMethodNotAllowed) http.Error(w, http.StatusText(http.StatusNotFound), http.StatusMethodNotAllowed)
return return
} }
return
})) }))
defer ts.Close() defer ts.Close()
@ -793,7 +772,6 @@ func TestMarkConversationsAsRead(t *testing.T) {
http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound) http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
return return
} }
return
})) }))
defer ts.Close() defer ts.Close()