-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
74777f1
commit 94080d6
Showing
4 changed files
with
48 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
import org.junit.jupiter.api.Test; | ||
|
||
import dev.jbang.catalog.Alias; | ||
import dev.jbang.catalog.Catalog; | ||
import dev.jbang.catalog.ImplicitCatalogRef; | ||
import dev.jbang.cli.ExitException; | ||
|
||
|
@@ -18,6 +19,16 @@ | |
*/ | ||
public class TestImplicitAlias extends BaseTest { | ||
|
||
@Test | ||
public void testValidity() { | ||
assertThat(Catalog.isValidCatalogReference("h2@org/repo"), Matchers.is(true)); | ||
assertThat(Catalog.isValidCatalogReference("h2@org"), Matchers.is(true)); | ||
assertThat(Catalog.isValidCatalogReference("h2@/org"), Matchers.is(true)); | ||
assertThat(Catalog.isValidCatalogReference("h2@"), Matchers.is(true)); | ||
assertThat(Catalog.isValidCatalogReference("h2@/"), Matchers.is(false)); | ||
|
||
} | ||
|
||
@Test | ||
public void testGitImplicitCatalog() { | ||
assertThat(ImplicitCatalogRef.getImplicitCatalogUrl("jbangdev").get(), | ||
|
@@ -32,6 +43,7 @@ public void testDefaultImplicitCatalog() { | |
Matchers.equalTo("https://github.com/jbangapp/jbang-catalog/blob/HEAD/jbang-catalog.json")); | ||
assertThat(ImplicitCatalogRef.getImplicitCatalogUrl("/sqlline").get(), | ||
Matchers.equalTo("https://github.com/jbangapp/sqlline/blob/HEAD/jbang-catalog.json")); | ||
|
||
} | ||
|
||
@Test | ||
|
@@ -46,11 +58,31 @@ public void testDefaultCatalogGet() { | |
} | ||
|
||
@Test | ||
public void testImplictURLAlias() { | ||
public void testjbangapph2atapp() { | ||
Alias url = Alias.get("h2@jbangapp"); | ||
assertThat(url.catalog.catalogRef.getOriginalResource(), | ||
Matchers.equalTo("https://github.com/jbangapp/jbang-catalog/blob/HEAD/jbang-catalog.json")); | ||
} | ||
|
||
@Test | ||
public void testjbangapph2at() { | ||
Alias url = Alias.get("h2@"); | ||
assertThat(url.catalog.catalogRef.getOriginalResource(), | ||
Matchers.equalTo("https://github.com/jbangapp/jbang-catalog/blob/HEAD/jbang-catalog.json")); | ||
|
||
} | ||
|
||
@Test | ||
public void testjbangappsqlline() { | ||
Alias url = Alias.get("sqlline@/sqlline"); | ||
assertThat(url.catalog.catalogRef.getOriginalResource(), | ||
Matchers.equalTo("https://github.com/jbangapp/sqlline/blob/HEAD/jbang-catalog.json")); | ||
} | ||
|
||
@Test | ||
public void testImplictURLAlias() { | ||
Alias url = Alias.get("[email protected]"); | ||
assertThat(url.scriptRef, Matchers.equalTo("tree/main.java")); | ||
|
||
} | ||
|
||
@Test | ||
|