TestFormatter_NonExistentFile tests handling of non-existent files
(t *testing.T)
| 287 | |
| 288 | // TestFormatter_NonExistentFile tests handling of non-existent files |
| 289 | func TestFormatter_NonExistentFile(t *testing.T) { |
| 290 | var outBuf, errBuf bytes.Buffer |
| 291 | formatter := NewFormatter(&outBuf, &errBuf, CLIFormatterOptions{ |
| 292 | IndentSize: 2, |
| 293 | Uppercase: true, |
| 294 | }) |
| 295 | |
| 296 | result := formatter.formatFile("/nonexistent/file.sql") |
| 297 | |
| 298 | if result.Error == nil { |
| 299 | t.Error("Expected error for non-existent file") |
| 300 | } |
| 301 | |
| 302 | if result.Changed { |
| 303 | t.Error("Expected changed=false for non-existent file") |
| 304 | } |
| 305 | |
| 306 | if !strings.Contains(result.Error.Error(), "file access validation failed") { |
| 307 | t.Errorf("Expected 'file access validation failed' error, got: %v", result.Error) |
| 308 | } |
| 309 | } |
| 310 | |
| 311 | // TestFormatter_EmptyArgs tests handling of empty file arguments |
| 312 | func TestFormatter_EmptyArgs(t *testing.T) { |
nothing calls this directly
no test coverage detected