github.com/go/docker@v1.12.0-rc2/utils/utils_test.go (about) 1 package utils 2 3 import "testing" 4 5 func TestReplaceAndAppendEnvVars(t *testing.T) { 6 var ( 7 d = []string{"HOME=/"} 8 o = []string{"HOME=/root", "TERM=xterm"} 9 ) 10 11 env := ReplaceOrAppendEnvValues(d, o) 12 if len(env) != 2 { 13 t.Fatalf("expected len of 2 got %d", len(env)) 14 } 15 if env[0] != "HOME=/root" { 16 t.Fatalf("expected HOME=/root got '%s'", env[0]) 17 } 18 if env[1] != "TERM=xterm" { 19 t.Fatalf("expected TERM=xterm got '%s'", env[1]) 20 } 21 }