github.com/docker/libcompose@v0.4.1-0.20210616120443-2a046c0bdbf2/lookup/simple_env_test.go (about) 1 package lookup 2 3 import ( 4 "testing" 5 ) 6 7 func TestOsEnvLookup(t *testing.T) { 8 osEnvLookup := &OsEnvLookup{} 9 10 envs := osEnvLookup.Lookup("PATH", nil) 11 if len(envs) != 1 { 12 t.Fatalf("Expected envs to contains one element, but was %v", envs) 13 } 14 15 envs = osEnvLookup.Lookup("path", nil) 16 if len(envs) != 0 { 17 t.Fatalf("Expected envs to be empty, but was %v", envs) 18 } 19 20 envs = osEnvLookup.Lookup("DOES_NOT_EXIST", nil) 21 if len(envs) != 0 { 22 t.Fatalf("Expected envs to be empty, but was %v", envs) 23 } 24 }