Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test file path needs to be OS aware #155

Merged
merged 1 commit into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading