aboutsummaryrefslogtreecommitdiffstats
path: root/modules/test/utils.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/test/utils.go')
-rw-r--r--modules/test/utils.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/modules/test/utils.go b/modules/test/utils.go
index 4a0c2f1b3b..8dee92fbce 100644
--- a/modules/test/utils.go
+++ b/modules/test/utils.go
@@ -34,8 +34,10 @@ 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()) {
+func MockVariableValue[T any](p *T, v ...T) (reset func()) {
old := *p
- *p = v
+ if len(v) > 0 {
+ *p = v[0]
+ }
return func() { *p = old }
}