summaryrefslogtreecommitdiffstats
path: root/modules/test/utils.go
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2023-08-05 23:36:45 +0800
committerGitHub <noreply@github.com>2023-08-05 23:36:45 +0800
commitd92b4cd0935fcb7be3fb30253426988aada78d32 (patch)
treecf09184e89a46fc4ee8b1b8901da5f4712dba162 /modules/test/utils.go
parent4f513474dce9788bead4799fefe2ed2fdfa75213 (diff)
downloadgitea-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.go6
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 }
+}