A lightweight mechanism to provide an *instant kickstart* to a Go web server instance upon changing any Go source files under the project directory (and its subdirectories).

syscall_test.go 782B

123456789101112131415161718192021222324252627282930313233
  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.
  4. // +build plan9
  5. package plan9_test
  6. import (
  7. "testing"
  8. "golang.org/x/sys/plan9"
  9. )
  10. func testSetGetenv(t *testing.T, key, value string) {
  11. err := plan9.Setenv(key, value)
  12. if err != nil {
  13. t.Fatalf("Setenv failed to set %q: %v", value, err)
  14. }
  15. newvalue, found := plan9.Getenv(key)
  16. if !found {
  17. t.Fatalf("Getenv failed to find %v variable (want value %q)", key, value)
  18. }
  19. if newvalue != value {
  20. t.Fatalf("Getenv(%v) = %q; want %q", key, newvalue, value)
  21. }
  22. }
  23. func TestEnv(t *testing.T) {
  24. testSetGetenv(t, "TESTENV", "AVALUE")
  25. // make sure TESTENV gets set to "", not deleted
  26. testSetGetenv(t, "TESTENV", "")
  27. }