diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2023-08-05 23:36:45 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-05 23:36:45 +0800 |
commit | d92b4cd0935fcb7be3fb30253426988aada78d32 (patch) | |
tree | cf09184e89a46fc4ee8b1b8901da5f4712dba162 /modules/test/utils.go | |
parent | 4f513474dce9788bead4799fefe2ed2fdfa75213 (diff) | |
download | gitea-d92b4cd0935fcb7be3fb30253426988aada78d32.tar.gz gitea-d92b4cd0935fcb7be3fb30253426988aada78d32.zip |
Fix incorrect CLI exit code and duplicate error message (#26346)
Follow the CLI refactoring, and add tests.
Diffstat (limited to 'modules/test/utils.go')
-rw-r--r-- | modules/test/utils.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/test/utils.go b/modules/test/utils.go index 2917741c45..4a0c2f1b3b 100644 --- a/modules/test/utils.go +++ b/modules/test/utils.go @@ -33,3 +33,9 @@ func RedirectURL(resp http.ResponseWriter) string { func IsNormalPageCompleted(s string) bool { return strings.Contains(s, `<footer class="page-footer"`) && strings.Contains(s, `</html>`) } + +func MockVariableValue[T any](p *T, v T) (reset func()) { + old := *p + *p = v + return func() { *p = old } +} |