From 045ebb64bcf93c7227c7fe0497c6cde1fdbc0aac Mon Sep 17 00:00:00 2001 From: Jason Date: Mon, 2 Sep 2024 18:59:40 +1000 Subject: [PATCH] test(dir): test unset HOME Signed-off-by: Jason --- dir/path_test.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dir/path_test.go b/dir/path_test.go index 638966eb..ffa20c01 100644 --- a/dir/path_test.go +++ b/dir/path_test.go @@ -43,6 +43,14 @@ func Test_UserConfigDirPath(t *testing.T) { } } +func Test_NoHomeVariable(t *testing.T) { + t.Setenv("HOME", "") + userConfigDir := UserConfigDirPath() + if userConfigDir != "notation" { + t.Fatalf(`UserConfigDirPath() = %q, want "notation"`, userConfigDir) + } +} + func Test_UserLibexecDirPath(t *testing.T) { userConfigDir = mockGetUserConfig got := UserLibexecDirPath() @@ -51,7 +59,6 @@ func Test_UserLibexecDirPath(t *testing.T) { } } - func TestLocalKeyPath(t *testing.T) { userConfigDir = mockGetUserConfig loadUserPath()