This repository has been archived on 2026-08-16. You can view files and clone it, but cannot push or open issues or pull requests.
ollie-core/pkg/paths/paths_test.go

37 lines
870 B
Go

package paths
import (
"os"
"testing"
)
func TestCfgDirFromEnv(t *testing.T) {
t.Setenv("OLLIE_CFG_PATH", "/custom/cfg")
if got := CfgDir(); got != "/custom/cfg" {
t.Errorf("CfgDir() = %q; want /custom/cfg", got)
}
}
func TestCfgDirDefault(t *testing.T) {
t.Setenv("OLLIE_CFG_PATH", "")
home, _ := os.UserHomeDir()
if got := CfgDir(); got != home+"/.config/ollie" {
t.Errorf("CfgDir() = %q; want %s/.config/ollie", got, home)
}
}
func TestDataDirFromEnv(t *testing.T) {
t.Setenv("OLLIE_DATA_PATH", "/custom/data")
if got := DataDir(); got != "/custom/data" {
t.Errorf("DataDir() = %q; want /custom/data", got)
}
}
func TestDataDirDefault(t *testing.T) {
t.Setenv("OLLIE_DATA_PATH", "")
home, _ := os.UserHomeDir()
if got := DataDir(); got != home+"/.local/share/ollie" {
t.Errorf("DataDir() = %q; want %s/.local/share/ollie", got, home)
}
}