-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix incorrect test code for error handling #27139
Conversation
But if |
Yes. But there could be no different no matter the "defer" comes before or after if there is no return, the code could still execute to I do not consider it as a serious problem in test code. But since |
🚀 |
This code is cleaner than the panic but we would need to rewrite lots of tests. At the moment we don't evade panics and I see not much value in doing so. The code in this PR for example should check the returned repo with It would be better to use |
Agree with it (also my comment #27139 (comment): In some cases, |
I think we can merged this. If it doesn't look good or need future improvements, feel free to revert and/or propose new fixes. |
* giteaofficial/main: Improve actions docs related to `pull_request` event (go-gitea#27126) Remove outdated paragraphs when comparing Gitea Actions to GitHub Actions (go-gitea#27119) Fix: treat tab "overview" as "repositories" in user profiles without readme (go-gitea#27124) Fix incorrect test code for error handling (go-gitea#27139) Increase auth provider icon size on login page (go-gitea#27122) fix pagination for followers and following (go-gitea#27127) services/wiki: Close() after error handling (go-gitea#27129) Use fetch helpers instead of fetch (go-gitea#27026) Change green buttons to primary color (go-gitea#27099) Fix wrong xorm get usage on migration (go-gitea#27111) Fix the incorrect route path in the user edit page. (go-gitea#27007) Refactor lfs requests (go-gitea#26783) Display archived labels specially when listing labels (go-gitea#26820) Remove a `gt-float-right` and some unnecessary helpers (go-gitea#27110) [skip ci] Updated licenses and gitignores Fix token endpoints ignore specified account (go-gitea#27080) Make SSPI auth mockable (go-gitea#27036)
* origin/main: Fix dropdown icon position (go-gitea#27175) Fix repo sub menu (go-gitea#27169) Fix review request number and add more tests (go-gitea#27104) Fix the variable regexp pattern on web page (go-gitea#27161) Fix organization field being null in POST /orgs/{orgid}/teams (go-gitea#27150) Add index to `issue_user.issue_id` (go-gitea#27154) [skip ci] Updated translations via Crowdin Start development on Gitea 1.22 (go-gitea#27155) Fix successful return value for `SyncAndGetUserSpecificDiff` (go-gitea#27152) Improve actions docs related to `pull_request` event (go-gitea#27126) Remove outdated paragraphs when comparing Gitea Actions to GitHub Actions (go-gitea#27119) Fix: treat tab "overview" as "repositories" in user profiles without readme (go-gitea#27124) Fix incorrect test code for error handling (go-gitea#27139) Increase auth provider icon size on login page (go-gitea#27122) fix pagination for followers and following (go-gitea#27127) services/wiki: Close() after error handling (go-gitea#27129) Use fetch helpers instead of fetch (go-gitea#27026) Change green buttons to primary color (go-gitea#27099) Fix wrong xorm get usage on migration (go-gitea#27111)
If
assert.NoError
fails, it should return. Otherwise the code could still execute even if the error occurs.