feat(mocktesting): initial implementation

This commit is contained in:
2021-11-21 22:03:11 +00:00
parent 7209ef72c6
commit 5b84721b10
11 changed files with 3564 additions and 0 deletions

31
t_go116.go Normal file
View File

@@ -0,0 +1,31 @@
//go:build go1.16
// +build go1.16
package mocktesting
func (t *T) Setenv(key string, value string) {
t.mux.Lock()
defer t.mux.Unlock()
if t.env == nil {
t.env = map[string]string{}
}
if key != "" {
t.env[key] = value
}
}
// Getenv returns a map[string]string of keys/values given to Setenv().
func (t *T) Getenv() map[string]string {
if t.env == nil {
t.mux.Lock()
t.env = map[string]string{}
t.mux.Unlock()
}
t.mux.RLock()
defer t.mux.RUnlock()
return t.env
}