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:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user