Commits

Miki Tebeka  committed 8ee1c62

Right way of getting exit status and gofmt

  • Participants
  • Parent commits 442ca15

Comments (0)

Files changed (1)

File atexit_test.go

 	"os"
 )
 
-
 func TestRegister(t *testing.T) {
 	current := len(handlers)
 	Register(func() {})
-	if len(handlers) != current + 1 {
+	if len(handlers) != current+1 {
 		t.Fatalf("can't add handler")
 	}
 }
 	}
 
 	err := exec.Command("./6.out", filename, arg).Run()
-	if err.String() != "exit status 1" {
-		t.Fatalf("bad exit status (%s), should be 1", err)
+	if wmsg, ok := err.(*os.Waitmsg); ok {
+		if wmsg.ExitStatus() != 1 {
+			t.Fatalf("bad exit status (%s), should be 1", wmsg.ExitStatus())
+		}
+	} else {
+		t.Fatalf("bad exit status 0, should be 1")
 	}
 
 	data, err := ioutil.ReadFile(filename)