Close out the repository audit

This commit is contained in:
2026-08-13 13:52:16 +00:00
parent 13b06039b1
commit fc8ddada9a
29 changed files with 421 additions and 263 deletions

View File

@@ -0,0 +1,26 @@
// Package testutil contains test-only helpers shared across package suites.
package testutil
import (
"errors"
"io/fs"
"os"
"testing"
)
// RequireSymlink creates a symbolic link or skips when the host explicitly
// reports that the operation is unsupported or unavailable to the test user.
// Unexpected setup failures remain test failures.
func RequireSymlink(t testing.TB, target, link string) {
t.Helper()
if err := os.Symlink(target, link); err != nil {
if symlinkUnavailable(err) {
t.Skipf("symlink support is unavailable: %v", err)
}
t.Fatalf("create symlink %q -> %q: %v", link, target, err)
}
}
func symlinkUnavailable(err error) bool {
return errors.Is(err, fs.ErrPermission) || errors.Is(err, errors.ErrUnsupported) || platformSymlinkUnavailable(err)
}