github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/utils/home/home_test.go (about) 1 //go:build !windows 2 // +build !windows 3 4 package home 5 6 import ( 7 "os/user" 8 "testing" 9 10 "github.com/lmorg/murex/test/count" 11 ) 12 13 // TestMyHome tests your home directory can be derived 14 func TestMyHome(t *testing.T) { 15 count.Tests(t, 1) 16 if MyDir == "" { 17 t.Error("MyDir not set (murex will still function)") 18 } 19 } 20 21 // TestUserHome tests a users home directory can be derived 22 func TestUserHome(t *testing.T) { 23 count.Tests(t, 1) 24 25 u, err := user.Current() 26 if err != nil { 27 t.Error("Error querying user.Current: " + err.Error() + " (murex will still function)") 28 } 29 30 if UserDir(u.Username) == "" { 31 t.Error("UserDir returning empty string (murex will still function)") 32 } 33 }