-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
091b366
commit aa5c4a7
Showing
3 changed files
with
211 additions
and
180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package stew | ||
|
||
import ( | ||
"os" | ||
"path/filepath" | ||
"testing" | ||
) | ||
|
||
func TestGetDefaultStewPath(t *testing.T) { | ||
homeDir, err := os.UserHomeDir() | ||
if err != nil { | ||
t.Errorf("Could not get os.UserHomeDir()") | ||
} | ||
type args struct { | ||
userOS string | ||
} | ||
tests := []struct { | ||
name string | ||
args args | ||
want string | ||
wantErr bool | ||
}{ | ||
{ | ||
name: "test1", | ||
args: args{ | ||
userOS: "darwin", | ||
}, | ||
want: filepath.Join(homeDir, ".local", "share", "stew"), | ||
wantErr: false, | ||
}, | ||
{ | ||
name: "test2", | ||
args: args{ | ||
userOS: "windows", | ||
}, | ||
want: filepath.Join(homeDir, "AppData", "Local", "stew"), | ||
wantErr: false, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
got, err := GetDefaultStewPath(tt.args.userOS) | ||
if (err != nil) != tt.wantErr { | ||
t.Errorf("GetDefaultStewPath() error = %v, wantErr %v", err, tt.wantErr) | ||
return | ||
} | ||
if got != tt.want { | ||
t.Errorf("GetDefaultStewPath() = %v, want %v", got, tt.want) | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.