Skip to content

Commit

Permalink
Fix TestSuiteResolver parse path containing "@" symbol (#266)
Browse files Browse the repository at this point in the history
* Fix issue by using last occurrence of '@' symbol

* Improve fix to only check filename for @ symbol

---------

Co-authored-by: Lukas Forer <[email protected]>
  • Loading branch information
alexlyttle and lukfor authored Dec 3, 2024
1 parent e1f9604 commit f63904b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/main/java/com/askimed/nf/test/core/TestSuiteResolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import com.askimed.nf.test.lang.TestSuiteBuilder;

import java.io.File;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.Vector;

Expand All @@ -24,9 +26,13 @@ public List<ITestSuite> parse(List<File> scripts, TagQuery tagQuery) throws Thro

for (File script : scripts) {
String testId = null;
if (script.getAbsolutePath().contains("@")) {
String[] tiles = script.getAbsolutePath().split("@");
script = new File(tiles[0]);
Path path = Paths.get(script.getAbsolutePath());
String fileName = path.getFileName().toString();

if (fileName.contains("@")) {
String[] tiles = fileName.split("@");
String basePath = path.getParent().toString();
script = new File(Paths.get(basePath, tiles[0]).toString());
testId = tiles[1];
}
if (!script.exists()) {
Expand Down

0 comments on commit f63904b

Please sign in to comment.