File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,8 @@ import (
21
21
"path/filepath"
22
22
"strings"
23
23
"testing"
24
+
25
+ "github.com/google/go-cmp/cmp"
24
26
)
25
27
26
28
// Each case must be positive when the rule in test
@@ -155,15 +157,24 @@ func TestRules_DisabledByConfig(t *testing.T) {
155
157
}
156
158
157
159
func TestBuildErrors (t * testing.T ) {
158
- expected := `internal/testdata/build_errors.proto:8:1: expected ';'
159
- internal/testdata/build_errors.proto:13:1: expected ';'`
160
+ expected := []string {
161
+ "internal/testdata/build_errors.proto:8:1:" ,
162
+ "internal/testdata/build_errors.proto:13:1:" ,
163
+ }
160
164
err := runCLI ([]string {"internal/testdata/build_errors.proto" })
161
165
if err == nil {
162
166
t .Fatal ("expected build error for build_errors.proto" )
163
167
}
164
168
actual := err .Error ()
165
- if expected != actual {
166
- t .Fatalf ("expected %q, got %q" , expected , actual )
169
+ actualLines := strings .Split (strings .TrimSpace (actual ), "\n " )
170
+ for idx , line := range actualLines {
171
+ if idx := strings .IndexByte (line , ' ' ); idx > - 1 {
172
+ line = line [:idx ]
173
+ }
174
+ actualLines [idx ] = line
175
+ }
176
+ if diff := cmp .Diff (expected , actualLines ); diff != "" {
177
+ t .Fatalf ("unexpected errors: diff (-want +got):\n %s" , diff )
167
178
}
168
179
}
169
180
You can’t perform that action at this time.
0 commit comments