@@ -219,7 +219,7 @@ func TestConfigPath_ConfigInCWD(t *testing.T) {
219219 t .Fatalf ("Cannot Getwd, got: %s" , err )
220220 }
221221
222- cwd := pwd + "/testdata"
222+ cwd := pwd + "/testdata/config_files "
223223
224224 oldDir , _ := os .Getwd ()
225225 err = os .Chdir (cwd )
@@ -232,7 +232,7 @@ func TestConfigPath_ConfigInCWD(t *testing.T) {
232232 if err != nil {
233233 t .Fatalf ("didn't expect an error, got: %s" , err )
234234 }
235- expPath := cwd + "/.phraseapp .yml"
235+ expPath := cwd + "/.phrase .yml"
236236 if path != expPath {
237237 t .Errorf ("expected path to be %q, got %q" , expPath , path )
238238 }
@@ -269,7 +269,7 @@ func TestConfigPath_ConfigInHomeDir(t *testing.T) {
269269 t .Fatalf ("Cannot Getwd, got: %s" , err )
270270 }
271271
272- cwd := pwd + "/testdata/empty "
272+ cwd := pwd + "/testdata/empty2 "
273273
274274 oldDir , _ := os .Getwd ()
275275 err = os .Chdir (cwd )
@@ -278,7 +278,7 @@ func TestConfigPath_ConfigInHomeDir(t *testing.T) {
278278 }
279279 defer os .Chdir (oldDir )
280280
281- newHome := pwd + "/testdata"
281+ newHome := pwd + "/testdata/config_files "
282282 oldHome := os .Getenv ("HOME" )
283283 os .Setenv ("HOME" , newHome )
284284 defer os .Setenv ("HOME" , oldHome )
@@ -287,7 +287,32 @@ func TestConfigPath_ConfigInHomeDir(t *testing.T) {
287287 if err != nil {
288288 t .Fatalf ("didn't expect an error, got: %s" , err )
289289 }
290- expPath := newHome + "/.phraseapp.yml"
290+ expPath := newHome + "/.phrase.yml"
291+ if path != expPath {
292+ t .Errorf ("expected path to be %q, got %q" , expPath , path )
293+ }
294+ }
295+
296+ func TestConfigPath_ConfigInParentDir (t * testing.T ) {
297+ pwd , err := os .Getwd ()
298+ if err != nil {
299+ t .Fatalf ("Cannot Getwd, got: %s" , err )
300+ }
301+
302+ cwd := pwd + "/testdata/config_files/empty"
303+
304+ oldDir , _ := os .Getwd ()
305+ err = os .Chdir (cwd )
306+ if err != nil {
307+ t .Fatalf ("didn't expect an error changing the working directory, got: %s" , err )
308+ }
309+ defer os .Chdir (oldDir )
310+
311+ path , err := configPath ()
312+ if err != nil {
313+ t .Fatalf ("didn't expect an error, got: %s" , err )
314+ }
315+ expPath := pwd + "/testdata/config_files/.phrase.yml"
291316 if path != expPath {
292317 t .Errorf ("expected path to be %q, got %q" , expPath , path )
293318 }
@@ -302,7 +327,7 @@ func TestConfigPath_NoConfigAvailable(t *testing.T) {
302327 t .Fatalf ("Cannot Getwd, got: %s" , err )
303328 }
304329
305- cwd := pwd + "/testdata/empty "
330+ cwd := pwd + "/testdata/empty2 "
306331
307332 oldDir , _ := os .Getwd ()
308333 err = os .Chdir (cwd )
@@ -318,7 +343,7 @@ func TestConfigPath_NoConfigAvailable(t *testing.T) {
318343 t .Fatalf ("Cannot Getwd, got: %s" , err )
319344 }
320345
321- os .Setenv ("HOME" , pwd + "/testdata/empty2 " )
346+ os .Setenv ("HOME" , pwd + "/testdata" )
322347 defer os .Setenv ("HOME" , oldHome )
323348
324349 path , err := configPath ()
0 commit comments