( t *testing.T, stdout string, wantCode toolspkg.ErrorCode, wantReason toolspkg.ReasonCode, )
| 1033 | } |
| 1034 | |
| 1035 | func assertToolError( |
| 1036 | t *testing.T, |
| 1037 | stdout string, |
| 1038 | wantCode toolspkg.ErrorCode, |
| 1039 | wantReason toolspkg.ReasonCode, |
| 1040 | ) { |
| 1041 | t.Helper() |
| 1042 | |
| 1043 | var response ToolErrorResponseRecord |
| 1044 | decodeJSONOutput(t, stdout, &response) |
| 1045 | if got := response.Error.Code; got != wantCode { |
| 1046 | t.Fatalf("error code = %q, want %q; stdout=%s", got, wantCode, stdout) |
| 1047 | } |
| 1048 | if len(response.Error.ReasonCodes) == 0 || response.Error.ReasonCodes[0] != wantReason { |
| 1049 | t.Fatalf("reason codes = %#v, want first %q; stdout=%s", response.Error.ReasonCodes, wantReason, stdout) |
| 1050 | } |
| 1051 | if len(response.Error.Details) > 0 { |
| 1052 | t.Fatalf("details = %#v, want redacted/omitted", response.Error.Details) |
| 1053 | } |
| 1054 | } |
| 1055 | |
| 1056 | func sampleToolsResponse() ToolsResponseRecord { |
| 1057 | return ToolsResponseRecord{Tools: []ToolRecord{ |
no test coverage detected