From a7da37a996c73d3b64dc4aef9e8cfe3d684c1004 Mon Sep 17 00:00:00 2001 From: Takumi Kanada Date: Sat, 27 Nov 2021 15:42:46 +0900 Subject: [PATCH] Fix testdata position --- internal/config/config_test.go | 2 +- .../testdata/config => internal/config/testdata}/free.yaml | 0 .../config => internal/config/testdata}/not_unmarshal.yaml | 0 .../testdata/config => internal/config/testdata}/pro.yaml | 0 test/helper.go | 7 ------- 5 files changed, 1 insertion(+), 8 deletions(-) rename {test/testdata/config => internal/config/testdata}/free.yaml (100%) rename {test/testdata/config => internal/config/testdata}/not_unmarshal.yaml (100%) rename {test/testdata/config => internal/config/testdata}/pro.yaml (100%) diff --git a/internal/config/config_test.go b/internal/config/config_test.go index dbc8c67..47ade54 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -63,7 +63,7 @@ func TestParseConfig(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - configPath := filepath.Join(test.ProjectDirPath(), "test", "testdata", "config", tt.inputConfigFile) + configPath := filepath.Join("testdata", tt.inputConfigFile) gotConfig, gotErr := ParseConfig(configPath) test.AssertError(t, gotErr, tt.wantErr) diff --git a/test/testdata/config/free.yaml b/internal/config/testdata/free.yaml similarity index 100% rename from test/testdata/config/free.yaml rename to internal/config/testdata/free.yaml diff --git a/test/testdata/config/not_unmarshal.yaml b/internal/config/testdata/not_unmarshal.yaml similarity index 100% rename from test/testdata/config/not_unmarshal.yaml rename to internal/config/testdata/not_unmarshal.yaml diff --git a/test/testdata/config/pro.yaml b/internal/config/testdata/pro.yaml similarity index 100% rename from test/testdata/config/pro.yaml rename to internal/config/testdata/pro.yaml diff --git a/test/helper.go b/test/helper.go index 0c821f8..c5bb81c 100644 --- a/test/helper.go +++ b/test/helper.go @@ -1,16 +1,9 @@ package test import ( - "os" - "path/filepath" "testing" ) -func ProjectDirPath() string { - currentDirPath, _ := os.Getwd() - return filepath.Join(currentDirPath, "..", "..") -} - func AssertError(t *testing.T, got, want error) { t.Helper() if got != want {