@@ -3,6 +3,7 @@ package config
33import (
44 "os"
55 "path/filepath"
6+ "runtime"
67 "strings"
78 "testing"
89)
@@ -219,9 +220,9 @@ func TestMissingFilesReturnEmptyConfig(t *testing.T) {
219220}
220221
221222func TestUserConfigPath (t * testing.T ) {
222- t .Setenv ("XDG_CONFIG_HOME" , "/tmp/ testxdg" )
223+ t .Setenv ("XDG_CONFIG_HOME" , filepath . Join ( os . TempDir (), " testxdg") )
223224 got := UserConfigPath ()
224- want := "/tmp/ testxdg/ forge/ config"
225+ want := filepath . Join ( os . TempDir (), " testxdg" , " forge" , " config")
225226 if got != want {
226227 t .Errorf ("expected %q, got %q" , want , got )
227228 }
@@ -264,13 +265,15 @@ func TestSetDomain(t *testing.T) {
264265 t .Error ("expected type in config" )
265266 }
266267
267- // Verify file permissions
268- info , err := os .Stat (path )
269- if err != nil {
270- t .Fatalf ("stat: %v" , err )
271- }
272- if info .Mode ().Perm () != 0600 {
273- t .Errorf ("expected 0600 permissions, got %o" , info .Mode ().Perm ())
268+ // Verify file permissions (skip on Windows, which doesn't support Unix perms)
269+ if runtime .GOOS != "windows" {
270+ info , err := os .Stat (path )
271+ if err != nil {
272+ t .Fatalf ("stat: %v" , err )
273+ }
274+ if info .Mode ().Perm () != 0600 {
275+ t .Errorf ("expected 0600 permissions, got %o" , info .Mode ().Perm ())
276+ }
274277 }
275278}
276279
0 commit comments