mirror of
https://code.forgejo.org/forgejo/runner.git
synced 2025-07-27 17:28:35 +00:00
chore(tests): MockVariable helper
This commit is contained in:
parent
df2524586e
commit
9650eb8a46
1 changed files with 10 additions and 0 deletions
10
internal/pkg/testutils/mockvariable.go
Normal file
10
internal/pkg/testutils/mockvariable.go
Normal file
|
@ -0,0 +1,10 @@
|
|||
// Copyright 2025 The Forgejo Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package testutils
|
||||
|
||||
func MockVariable[T any](p *T, v T) (reset func()) {
|
||||
old := *p
|
||||
*p = v
|
||||
return func() { *p = old }
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue