SetEnvConfig sets the value of the given variable to the specified value, taking care of restoring the original value after the test completes.
(t *testing.T, variable *T, value T)
| 24 | // SetEnvConfig sets the value of the given variable to the specified value, |
| 25 | // taking care of restoring the original value after the test completes. |
| 26 | func SetEnvConfig[T any](t *testing.T, variable *T, value T) { |
| 27 | t.Helper() |
| 28 | old := *variable |
| 29 | t.Cleanup(func() { |
| 30 | *variable = old |
| 31 | }) |
| 32 | *variable = value |
| 33 | } |
no outgoing calls