(t *testing.T)
| 13 | ) |
| 14 | |
| 15 | func TestAssertSecurePath_NonAbsolutePath(t *testing.T) { |
| 16 | _, err := AssertSecurePath(AuditParams{ |
| 17 | TargetPath: "relative/path.txt", |
| 18 | Label: "test", |
| 19 | AllowInsecurePath: true, |
| 20 | }) |
| 21 | if err == nil { |
| 22 | t.Fatal("expected error for non-absolute path, got nil") |
| 23 | } |
| 24 | want := fmt.Sprintf("test: path must be absolute, got %q", "relative/path.txt") |
| 25 | if err.Error() != want { |
| 26 | t.Errorf("error = %q, want %q", err.Error(), want) |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | func TestAssertSecurePath_FileDoesNotExist(t *testing.T) { |
| 31 | nonexistent := filepath.Join(t.TempDir(), "nonexistent.txt") |
nothing calls this directly
no test coverage detected