2013-05-14 18:37:35 -04:00
|
|
|
package utils
|
2013-01-18 19:13:39 -05:00
|
|
|
|
2015-12-14 05:15:00 -05:00
|
|
|
import "testing"
|
2013-01-18 19:13:39 -05:00
|
|
|
|
2014-03-01 02:29:00 -05:00
|
|
|
func TestReplaceAndAppendEnvVars(t *testing.T) {
|
|
|
|
var (
|
|
|
|
d = []string{"HOME=/"}
|
|
|
|
o = []string{"HOME=/root", "TERM=xterm"}
|
|
|
|
)
|
|
|
|
|
|
|
|
env := ReplaceOrAppendEnvValues(d, o)
|
|
|
|
if len(env) != 2 {
|
|
|
|
t.Fatalf("expected len of 2 got %d", len(env))
|
|
|
|
}
|
|
|
|
if env[0] != "HOME=/root" {
|
|
|
|
t.Fatalf("expected HOME=/root got '%s'", env[0])
|
|
|
|
}
|
|
|
|
if env[1] != "TERM=xterm" {
|
|
|
|
t.Fatalf("expected TERM=xterm got '%s'", env[1])
|
2015-02-26 21:23:50 -05:00
|
|
|
}
|
|
|
|
}
|