Skip to content

Commit

Permalink
fix: taking tabs into account as seprator for tag values (#1759)
Browse files Browse the repository at this point in the history
Fixes #1758
  • Loading branch information
quintesse committed Feb 26, 2024
1 parent 87c02ad commit d5dfb8c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/dev/jbang/source/TagReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ protected boolean isDependDeclare(String line) {
}

protected Stream<String> extractDependencies(String line) {
return Arrays.stream(line.split(" // ")[0].split("[ ;,]+")).skip(1).map(String::trim);
return Arrays.stream(line.split(" // ")[0].split("[ \t;,]+")).skip(1).map(String::trim);
}

private static boolean isGav(String ref) {
Expand Down
12 changes: 12 additions & 0 deletions src/test/java/dev/jbang/source/TestTagReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ void testExtractDependencies() {
assertThat(subs, containsInAnyOrder("something"));
}

@Test
void testExtractDependenciesSeparator() {
TagReader tr = new TagReader.Extended(
"//DEPS foo:bar, abc:DEF:123, \thttps://github.com/jbangdev/jbang \tsomething\t ", null);

List<String> deps = tr.collectBinaryDependencies();
assertThat(deps, containsInAnyOrder("foo:bar", "abc:DEF:123", "https://github.com/jbangdev/jbang"));

List<String> subs = tr.collectSourceDependencies();
assertThat(subs, containsInAnyOrder("something"));
}

@Test
void textExtractRepositories() {
List<MavenRepo> repos = new TagReader.Extended("//REPOS jcenter=https://xyz.org", null).collectRepositories();
Expand Down

0 comments on commit d5dfb8c

Please sign in to comment.