(t *testing.T)
| 28 | } |
| 29 | |
| 30 | func TestAssertSecurePath_FileDoesNotExist(t *testing.T) { |
| 31 | nonexistent := filepath.Join(t.TempDir(), "nonexistent.txt") |
| 32 | _, err := AssertSecurePath(AuditParams{ |
| 33 | TargetPath: nonexistent, |
| 34 | Label: "test", |
| 35 | AllowInsecurePath: true, |
| 36 | }) |
| 37 | if err == nil { |
| 38 | t.Fatal("expected error for non-existent file, got nil") |
| 39 | } |
| 40 | wantPrefix := fmt.Sprintf("test: cannot stat %q: ", nonexistent) |
| 41 | if !strings.HasPrefix(err.Error(), wantPrefix) { |
| 42 | t.Errorf("error = %q, want prefix %q", err.Error(), wantPrefix) |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | func TestAssertSecurePath_ValidAbsolutePath(t *testing.T) { |
| 47 | dir := t.TempDir() |
nothing calls this directly
no test coverage detected