(t *testing.T)
| 199 | } |
| 200 | |
| 201 | func TestFormatParseErrorJSON(t *testing.T) { |
| 202 | testErr := &testError{msg: "tokenization failed: invalid character"} |
| 203 | |
| 204 | jsonData, err := FormatParseErrorJSON(testErr, "SELECT * FROM") |
| 205 | if err != nil { |
| 206 | t.Fatalf("FormatParseErrorJSON failed: %v", err) |
| 207 | } |
| 208 | |
| 209 | var output JSONParseOutput |
| 210 | if err := json.Unmarshal(jsonData, &output); err != nil { |
| 211 | t.Fatalf("Failed to unmarshal JSON: %v", err) |
| 212 | } |
| 213 | |
| 214 | if output.Status != "error" { |
| 215 | t.Errorf("Expected status 'error', got '%s'", output.Status) |
| 216 | } |
| 217 | |
| 218 | if output.Error == nil { |
| 219 | t.Fatal("Expected error to be present") |
| 220 | } |
| 221 | |
| 222 | if output.Error.Type != "tokenization" { |
| 223 | t.Errorf("Expected error type 'tokenization', got '%s'", output.Error.Type) |
| 224 | } |
| 225 | |
| 226 | if output.Results != nil { |
| 227 | t.Error("Expected results to be nil on error") |
| 228 | } |
| 229 | } |
| 230 | |
| 231 | func TestCategorizeError(t *testing.T) { |
| 232 | tests := []struct { |
nothing calls this directly
no test coverage detected