/usr/share/gocode/src/github.com/constabulary/gb/cmd/env_test.go is in golang-github-constabulary-gb-dev 0.4.4-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | package cmd
import "testing"
func TestMergeEnv(t *testing.T) {
envTests := []struct {
env []string
args map[string]string
want []string
}{
{
env: nil,
args: nil,
want: nil,
},
{
env: []string{`FOO=BAR`, `BAZ="QUXX"`},
args: nil,
want: []string{`FOO=BAR`, `BAZ="QUXX"`},
},
{
env: []string{`FOO=BAR`, `BAZ="QUXX"`},
args: map[string]string{"BLORT": "false", "BAZ": "QUXX"},
want: []string{`FOO=BAR`, `BAZ=QUXX`, `BLORT=false`},
},
}
for _, tt := range envTests {
got := MergeEnv(tt.env, tt.args)
compare(t, tt.want, got)
}
}
func compare(t *testing.T, want, got []string) {
w, g := set(want), set(got)
for k := range w {
if w[k] != g[k] {
t.Errorf("want %v, got %v", k, g[k])
}
}
}
func set(v []string) map[string]bool {
m := make(map[string]bool)
for _, s := range v {
m[s] = true
}
return m
}
|