Skip to content

Commit

Permalink
Merge pull request #113 from xuwei-k/URL-constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
eed3si9n authored Jan 18, 2025
2 parents fd4b25d + 03458de commit 13f48e2
Showing 1 changed file with 22 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package xsbt.boot

import java.net.URL
import java.net.URI

object ConfigurationParserTest extends verify.BasicTestSuite {
test("Configuration parser should correct parse bootOnly") {
Expand All @@ -19,67 +19,69 @@ object ConfigurationParserTest extends verify.BasicTestSuite {
repoFileContains(
"""|[repositories]
| id: https://repo1.maven.org""".stripMargin,
Repository.Maven("id", new URL("https://repo1.maven.org"), false)
Repository.Maven("id", new URI("https://repo1.maven.org").toURL, false)
)

repoFileContains(
"""|[repositories]
| id: https://repo1.maven.org, bootOnly""".stripMargin,
Repository.Maven("id", new URL("https://repo1.maven.org"), true)
Repository.Maven("id", new URI("https://repo1.maven.org").toURL, true)
)

repoFileContains(
"""|[repositories]
| id: http://repo1.maven.org, bootOnly, allowInsecureProtocol""".stripMargin,
Repository.Maven("id", new URL("http://repo1.maven.org"), true, true)
Repository.Maven("id", new URI("http://repo1.maven.org").toURL, true, true)
)

repoFileContains(
"""|[repositories]
| id: https://repo1.maven.org, [orgPath]""".stripMargin,
Repository
.Ivy("id", new URL("https://repo1.maven.org"), "[orgPath]", "[orgPath]", false, false)
.Ivy("id", new URI("https://repo1.maven.org").toURL, "[orgPath]", "[orgPath]", false, false)
)

repoFileContains(
"""|[repositories]
| id: https://repo1.maven.org, [orgPath], mavenCompatible""".stripMargin,
Repository
.Ivy("id", new URL("https://repo1.maven.org"), "[orgPath]", "[orgPath]", true, false)
.Ivy("id", new URI("https://repo1.maven.org").toURL, "[orgPath]", "[orgPath]", true, false)
)

repoFileContains(
"""|[repositories]
| id: https://repo1.maven.org, [orgPath], mavenCompatible, bootOnly""".stripMargin,
Repository.Ivy("id", new URL("https://repo1.maven.org"), "[orgPath]", "[orgPath]", true, true)
Repository
.Ivy("id", new URI("https://repo1.maven.org").toURL, "[orgPath]", "[orgPath]", true, true)
)

repoFileContains(
"""|[repositories]
| id: https://repo1.maven.org, [orgPath], bootOnly, mavenCompatible""".stripMargin,
Repository.Ivy("id", new URL("https://repo1.maven.org"), "[orgPath]", "[orgPath]", true, true)
Repository
.Ivy("id", new URI("https://repo1.maven.org").toURL, "[orgPath]", "[orgPath]", true, true)
)

repoFileContains(
"""|[repositories]
| id: https://repo1.maven.org, [orgPath], bootOnly""".stripMargin,
Repository
.Ivy("id", new URL("https://repo1.maven.org"), "[orgPath]", "[orgPath]", false, true)
.Ivy("id", new URI("https://repo1.maven.org").toURL, "[orgPath]", "[orgPath]", false, true)
)

repoFileContains(
"""|[repositories]
| id: https://repo1.maven.org, [orgPath], [artPath]""".stripMargin,
Repository
.Ivy("id", new URL("https://repo1.maven.org"), "[orgPath]", "[artPath]", false, false)
.Ivy("id", new URI("https://repo1.maven.org").toURL, "[orgPath]", "[artPath]", false, false)
)

repoFileContains(
"""|[repositories]
| id: https://repo1.maven.org, [orgPath], [artPath], descriptorOptional""".stripMargin,
Repository.Ivy(
"id",
new URL("https://repo1.maven.org"),
new URI("https://repo1.maven.org").toURL,
"[orgPath]",
"[artPath]",
false,
Expand All @@ -94,7 +96,7 @@ object ConfigurationParserTest extends verify.BasicTestSuite {
| id: https://repo1.maven.org, [orgPath], [artPath], descriptorOptional, skipConsistencyCheck""".stripMargin,
Repository.Ivy(
"id",
new URL("https://repo1.maven.org"),
new URI("https://repo1.maven.org").toURL,
"[orgPath]",
"[artPath]",
false,
Expand All @@ -109,7 +111,7 @@ object ConfigurationParserTest extends verify.BasicTestSuite {
| id: https://repo1.maven.org, [orgPath], [artPath], skipConsistencyCheck, descriptorOptional""".stripMargin,
Repository.Ivy(
"id",
new URL("https://repo1.maven.org"),
new URI("https://repo1.maven.org").toURL,
"[orgPath]",
"[artPath]",
false,
Expand All @@ -124,7 +126,7 @@ object ConfigurationParserTest extends verify.BasicTestSuite {
| id: https://repo1.maven.org, [orgPath], [artPath], skipConsistencyCheck, descriptorOptional, mavenCompatible, bootOnly""".stripMargin,
Repository.Ivy(
"id",
new URL("https://repo1.maven.org"),
new URI("https://repo1.maven.org").toURL,
"[orgPath]",
"[artPath]",
true,
Expand All @@ -138,27 +140,29 @@ object ConfigurationParserTest extends verify.BasicTestSuite {
"""|[repositories]
| id: https://repo1.maven.org, [orgPath], [artPath], bootOnly""".stripMargin,
Repository
.Ivy("id", new URL("https://repo1.maven.org"), "[orgPath]", "[artPath]", false, true)
.Ivy("id", new URI("https://repo1.maven.org").toURL, "[orgPath]", "[artPath]", false, true)
)

repoFileContains(
"""|[repositories]
| id: https://repo1.maven.org, [orgPath], [artPath], bootOnly, mavenCompatible""".stripMargin,
Repository.Ivy("id", new URL("https://repo1.maven.org"), "[orgPath]", "[artPath]", true, true)
Repository
.Ivy("id", new URI("https://repo1.maven.org").toURL, "[orgPath]", "[artPath]", true, true)
)

repoFileContains(
"""|[repositories]
| id: https://repo1.maven.org, [orgPath], [artPath], mavenCompatible, bootOnly""".stripMargin,
Repository.Ivy("id", new URL("https://repo1.maven.org"), "[orgPath]", "[artPath]", true, true)
Repository
.Ivy("id", new URI("https://repo1.maven.org").toURL, "[orgPath]", "[artPath]", true, true)
)

repoFileContains(
"""|[repositories]
| id: http://repo1.maven.org, [orgPath], [artPath], mavenCompatible, bootOnly, allowInsecureProtocol""".stripMargin,
Repository.Ivy(
"id",
new URL("http://repo1.maven.org"),
new URI("http://repo1.maven.org").toURL,
"[orgPath]",
"[artPath]",
mavenCompatible = true,
Expand Down

0 comments on commit 13f48e2

Please sign in to comment.