Skip to content

Commit

Permalink
Test file path needs to be OS aware
Browse files Browse the repository at this point in the history
  • Loading branch information
Munsio committed Jun 4, 2024
1 parent b8b3f78 commit 4111208
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions language/java/language.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ 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) {
if l := strings.LastIndex(filePath, "src/main/java"); l != -1 {
t := "src/test/java"
if l := strings.LastIndex(filePath, filepath.Join("src", "main", "java")); l != -1 {
t := filepath.Join("src", "test", "java")
filePath = filePath[:l] + t + filePath[l+len(t):]
}

Expand Down
4 changes: 2 additions & 2 deletions language/java/language_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ func TestLanguageTestFilePath(t *testing.T) {
validate(t, &testCase{
Name: "Source file",

FilePath: "src/main/java/com/eval/Plain.java",
FilePath: filepath.Join("src", "main", "java", "com", "eval", "Plain.java"),

ExpectedTestFilePath: "src/test/java/com/eval/PlainTest.java",
ExpectedTestFilePath: filepath.Join("src", "test", "java", "com", "eval", "PlainTest.java"),
})
}

Expand Down

0 comments on commit 4111208

Please sign in to comment.