blob: 5b8af48b3726553792d6248c4e8c896c5886af42 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
//go:build test
package paths
var backups = make(map[*Path]string)
func SetAll(folder string) {
for _, p := range Paths {
Set(p, folder)
}
}
// Set temporarily sets the paths for unit test purposes
// remember to defer Reset
func Set(target *Path, value string) {
backups[target] = target.String()
target.Set(value)
}
// Reset sets the path variables back to before the unit test
func Reset() {
for path, oldValue := range backups {
path.Set(oldValue)
}
backups = make(map[*Path]string)
}
|