MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / TestValidator_NonExistentFile

Function TestValidator_NonExistentFile

cmd/gosqlx/cmd/validator_test.go:441–458  ·  view source on GitHub ↗

TestValidator_NonExistentFile tests handling of non-existent files

(t *testing.T)

Source from the content-addressed store, hash-verified

439
440// TestValidator_NonExistentFile tests handling of non-existent files
441func TestValidator_NonExistentFile(t *testing.T) {
442 var outBuf, errBuf bytes.Buffer
443 validator := NewValidator(&outBuf, &errBuf, ValidatorOptions{})
444
445 result := validator.validateFile("/nonexistent/file.sql")
446
447 if result.Error == nil {
448 t.Error("Expected error for non-existent file")
449 }
450
451 if result.Valid {
452 t.Error("Expected valid=false for non-existent file")
453 }
454
455 if !strings.Contains(result.Error.Error(), "file access validation failed") {
456 t.Errorf("Expected 'file access validation failed' error, got: %v", result.Error)
457 }
458}
459
460// TestValidator_PermissionDenied tests handling of permission-denied files
461func TestValidator_PermissionDenied(t *testing.T) {

Callers

nothing calls this directly

Calls 4

validateFileMethod · 0.95
NewValidatorFunction · 0.70
ErrorfMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected