1 // Copyright 2013 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
12 "golang.org/x/sys/plan9"
15 func testSetGetenv(t *testing.T, key, value string) {
16 err := plan9.Setenv(key, value)
18 t.Fatalf("Setenv failed to set %q: %v", value, err)
20 newvalue, found := plan9.Getenv(key)
22 t.Fatalf("Getenv failed to find %v variable (want value %q)", key, value)
24 if newvalue != value {
25 t.Fatalf("Getenv(%v) = %q; want %q", key, newvalue, value)
29 func TestEnv(t *testing.T) {
30 testSetGetenv(t, "TESTENV", "AVALUE")
31 // make sure TESTENV gets set to "", not deleted
32 testSetGetenv(t, "TESTENV", "")