Browse code

Fix stringer in Result (pkg\testutil\cmd)

Signed-off-by: John Howard (VM) <jhoward@ntdev.microsoft.com>

John Howard (VM) authored on 2017/03/11 08:21:51
Showing 1 changed files
... ...
@@ -59,9 +59,12 @@ func (r *Result) Assert(t testingT, exp Expected) {
59 59
 	if err == nil {
60 60
 		return
61 61
 	}
62
-
63
-	_, file, line, _ := runtime.Caller(1)
64
-	t.Fatalf("at %s:%d\n%s", filepath.Base(file), line, err.Error())
62
+	_, file, line, ok := runtime.Caller(1)
63
+	if ok {
64
+		t.Fatalf("at %s:%d - %s", filepath.Base(file), line, err.Error())
65
+	} else {
66
+		t.Fatalf("(no file/line info) - %s", err.Error())
67
+	}
65 68
 }
66 69
 
67 70
 // Compare returns a formatted error with the command, stdout, stderr, exit
... ...
@@ -123,10 +126,11 @@ func (r *Result) String() string {
123 123
 	}
124 124
 
125 125
 	return fmt.Sprintf(`
126
-Command: %s
127
-ExitCode: %d%s, Error: %s
128
-Stdout: %v
129
-Stderr: %v
126
+Command:  %s
127
+ExitCode: %d%s
128
+Error:    %v
129
+Stdout:   %v
130
+Stderr:   %v
130 131
 `,
131 132
 		strings.Join(r.Cmd.Args, " "),
132 133
 		r.ExitCode,