fix: skip file permission tests on Windows

Windows doesn't support Unix-style file permissions, so these tests
will always fail. Skip the permission verification on Windows while
still testing the core functionality (file creation, content).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-11-24 22:23:45 -08:00
parent 071fc96206
commit 45464ca3f9
2 changed files with 19 additions and 2 deletions

View File

@@ -8,6 +8,11 @@ import (
)
func TestFixGitignore_FilePermissions(t *testing.T) {
// Skip on Windows as it doesn't support Unix-style file permissions
if runtime.GOOS == "windows" {
t.Skip("Skipping file permissions test on Windows")
}
tests := []struct {
name string
setupFunc func(t *testing.T, tmpDir string) // setup before fix
@@ -194,6 +199,11 @@ func TestFixGitignore_FileOwnership(t *testing.T) {
}
func TestFixGitignore_DoesNotLoosenPermissions(t *testing.T) {
// Skip on Windows as it doesn't support Unix-style file permissions
if runtime.GOOS == "windows" {
t.Skip("Skipping file permissions test on Windows")
}
tmpDir := t.TempDir()
// Change to tmpDir for the test

View File

@@ -3,10 +3,14 @@ package setup
import (
"os"
"path/filepath"
"runtime"
"testing"
)
func TestAtomicWriteFile(t *testing.T) {
// Skip permission checks on Windows as it doesn't support Unix-style file permissions
skipPermissionChecks := runtime.GOOS == "windows"
// Create temp directory
tmpDir := t.TempDir()
testFile := filepath.Join(tmpDir, "test.txt")
@@ -35,7 +39,7 @@ func TestAtomicWriteFile(t *testing.T) {
}
mode := info.Mode()
if mode.Perm() != 0600 {
if !skipPermissionChecks && mode.Perm() != 0600 {
t.Errorf("file permissions mismatch: got %o, want %o", mode.Perm(), 0600)
}
@@ -114,6 +118,9 @@ func TestFileExists(t *testing.T) {
}
func TestEnsureDir(t *testing.T) {
// Skip permission checks on Windows as it doesn't support Unix-style file permissions
skipPermissionChecks := runtime.GOOS == "windows"
tmpDir := t.TempDir()
// Test creating new directory
@@ -134,7 +141,7 @@ func TestEnsureDir(t *testing.T) {
}
mode := info.Mode()
if mode.Perm() != 0755 {
if !skipPermissionChecks && mode.Perm() != 0755 {
t.Errorf("directory permissions mismatch: got %o, want %o", mode.Perm(), 0755)
}