Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import org.junit.Ignore
class CompletionScalaCliSuite extends BaseCompletionSuite:

@Test def `simple` =
check(
checkSubset(
"""|//> using lib "io.cir@@
|package A
|""".stripMargin,
Expand All @@ -30,24 +30,25 @@ class CompletionScalaCliSuite extends BaseCompletionSuite:
|//> using lib io.circe::circe-core_native0.4
|package A
|""".stripMargin,
assertSingleItem = false
assertSingleItem = false,
filter = _.contains("circe-core_native0.4")
)

@Test def `version-sort` =
check(
checkSubset(
"""|//> using dep "com.lihaoyi::pprint:0.7@@"
|package A
|""".stripMargin,
"""|0.7.3
|0.7.2
|0.7.1
|0.7.0
|""".stripMargin,
|""".stripMargin
)

@Ignore
@Test def `single-colon` =
check(
checkSubset(
"""|//> using lib "io.circe:circe-core_na@@
|package A
|""".stripMargin,
Expand All @@ -59,7 +60,7 @@ class CompletionScalaCliSuite extends BaseCompletionSuite:

@Ignore
@Test def `version` =
check(
checkSubset(
"""|//> using lib "io.circe::circe-core_sjs1:0.14.10@@"
|package A
|""".stripMargin,
Expand All @@ -76,11 +77,12 @@ class CompletionScalaCliSuite extends BaseCompletionSuite:
"""|//> using lib "io.circe::circe-core_sjs1:0.14.10"
|package A
|""".stripMargin,
filter = _.endsWith("0.14.10")
)

@Ignore
@Test def `multiple-libs` =
check(
checkSubset(
"""|//> using lib "io.circe::circe-core:0.14.0", "io.circe::circe-core_na@@"
|package A
|""".stripMargin,
Expand All @@ -89,7 +91,7 @@ class CompletionScalaCliSuite extends BaseCompletionSuite:

@Ignore
@Test def `script` =
check(
checkSubset(
scriptWrapper(
"""|//> using lib "io.circe:circe-core_na@@
|
Expand All @@ -105,15 +107,15 @@ class CompletionScalaCliSuite extends BaseCompletionSuite:
)

@Test def `closing-quote` =
check(
checkSubset(
"""|//> using lib "io.circe::circe-core:0.14.0"@@
|package A
|""".stripMargin,
""
)

@Test def `whitespace` =
check(
checkSubset(
"""|//> using lib "io.circe::circe-co @@
|package A
|""".stripMargin,
Expand All @@ -132,7 +134,7 @@ class CompletionScalaCliSuite extends BaseCompletionSuite:
)

@Test def `dep` =
check(
checkSubset(
"""|//> using dep "io.cir@@
|package A
|""".stripMargin,
Expand All @@ -142,13 +144,29 @@ class CompletionScalaCliSuite extends BaseCompletionSuite:

@Ignore
@Test def `multiple-deps2` =
check(
checkSubset(
"""|//> using libs "io.circe::circe-core:0.14.0", "io.circe::circe-core_na@@"
|package A
|""".stripMargin,
"circe-core_native0.4"
)

def checkSubset(
original: String,
expected: String,
filename: String = "A.scala",
enablePackageWrap: Boolean = true
) = {
val expectedAtLeast = expected.linesIterator.toSet
check(
original,
expected,
filter = expectedAtLeast,
filename = filename,
enablePackageWrap = enablePackageWrap
)
}

private def scriptWrapper(code: String, filename: String): String =
// Vaguely looks like a scala file that ScalaCLI generates
// from a sc file.
Expand Down
Loading