From af333f15045dfc651c97ed28aa612ca22f73b662 Mon Sep 17 00:00:00 2001 From: Rui Azevedo Date: Thu, 1 Aug 2024 16:22:17 +0100 Subject: [PATCH] refactor, Use the default language file extension and test file suffix functions, for consistency Part of #300 --- language/golang/language.go | 2 +- language/java/language.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/language/golang/language.go b/language/golang/language.go index e0358e51..9c6a6bb6 100644 --- a/language/golang/language.go +++ b/language/golang/language.go @@ -46,7 +46,7 @@ func (l *Language) ImportPath(projectRootPath string, filePath string) (importPa // TestFilePath returns the file path of a test file given the corresponding file path of the test's source file. func (l *Language) TestFilePath(projectRootPath string, filePath string) (testFilePath string) { - return strings.TrimSuffix(filePath, ".go") + "_test.go" + return strings.TrimSuffix(filePath, l.DefaultFileExtension()) + l.DefaultTestFileSuffix() } // TestFramework returns the human-readable name of the test framework that should be used. diff --git a/language/java/language.go b/language/java/language.go index 8698a5e9..8f27c782 100644 --- a/language/java/language.go +++ b/language/java/language.go @@ -62,7 +62,7 @@ func (l *Language) TestFilePath(projectRootPath string, filePath string) (testFi filePath = filePath[:l] + t + filePath[l+len(t):] } - return strings.TrimSuffix(filePath, ".java") + "Test.java" + return strings.TrimSuffix(filePath, l.DefaultFileExtension()) + l.DefaultTestFileSuffix() } // TestFramework returns the human-readable name of the test framework that should be used.