forked from golang/config
Change ConfigDir to ConfigFile
This commit is contained in:
+7
-7
@@ -35,11 +35,11 @@ func Test_getConfigDir_XDG_CONFIG_HOME(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func Test_ConfigGetConfigDir_HOME(t *testing.T) {
|
||||
func Test_ConfigGetConfigFile_HOME(t *testing.T) {
|
||||
os.Unsetenv("XDG_CONFIG_HOME")
|
||||
os.Setenv("HOME", "/tmp")
|
||||
|
||||
expected_config_dir := "/tmp/.config/test"
|
||||
expected_config_file := "/tmp/.config/test/test.toml"
|
||||
|
||||
config := Config[LocalConfig]{
|
||||
Name: "test",
|
||||
@@ -54,8 +54,8 @@ func Test_ConfigGetConfigDir_HOME(t *testing.T) {
|
||||
t.Errorf("Failed to get config: %v", err)
|
||||
}
|
||||
|
||||
if expected_config_dir != *config.ConfigDir {
|
||||
t.Errorf("config.ConfigDir is %v, %v expected", *config.ConfigDir, expected_config_dir)
|
||||
if expected_config_file != *config.ConfigFile {
|
||||
t.Errorf("config.ConfigFile is %v, %v expected", *config.ConfigFile, expected_config_file)
|
||||
} else {
|
||||
t.Log("Success!")
|
||||
}
|
||||
@@ -64,7 +64,7 @@ func Test_ConfigGetConfigDir_HOME(t *testing.T) {
|
||||
func Test_ConfigGetConfigDir_XDG_CONFIG_HOME(t *testing.T) {
|
||||
os.Setenv("XDG_CONFIG_HOME", "/tmp/")
|
||||
|
||||
expected_config_dir := "/tmp/test"
|
||||
expected_config_dir := "/tmp/test/test.toml"
|
||||
|
||||
config := Config[LocalConfig]{
|
||||
Name: "test",
|
||||
@@ -79,8 +79,8 @@ func Test_ConfigGetConfigDir_XDG_CONFIG_HOME(t *testing.T) {
|
||||
t.Errorf("Failed to get config: %v", err)
|
||||
}
|
||||
|
||||
if expected_config_dir != *config.ConfigDir {
|
||||
t.Errorf("config.ConfigDir is %v, %v expected", *config.ConfigDir, expected_config_dir)
|
||||
if expected_config_dir != *config.ConfigFile {
|
||||
t.Errorf("config.ConfigFile is %v, %v expected", *config.ConfigFile, expected_config_dir)
|
||||
} else {
|
||||
t.Log("Success!")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user