@@ -8,7 +8,7 @@ import org.junit.Ignore
88class CompletionScalaCliSuite extends BaseCompletionSuite :
99
1010 @ Test def `simple` =
11- check (
11+ checkSubset (
1212 """ |//> using lib "io.cir@@
1313 |package A
1414 |""" .stripMargin,
@@ -30,24 +30,25 @@ class CompletionScalaCliSuite extends BaseCompletionSuite:
3030 |//> using lib io.circe::circe-core_native0.4
3131 |package A
3232 |""" .stripMargin,
33- assertSingleItem = false
33+ assertSingleItem = false ,
34+ filter = _.contains(" circe-core_native0.4" )
3435 )
3536
3637 @ Test def `version-sort` =
37- check (
38+ checkSubset (
3839 """ |//> using dep "com.lihaoyi::pprint:0.7@@"
3940 |package A
4041 |""" .stripMargin,
4142 """ |0.7.3
4243 |0.7.2
4344 |0.7.1
4445 |0.7.0
45- |""" .stripMargin,
46+ |""" .stripMargin
4647 )
4748
4849 @ Ignore
4950 @ Test def `single-colon` =
50- check (
51+ checkSubset (
5152 """ |//> using lib "io.circe:circe-core_na@@
5253 |package A
5354 |""" .stripMargin,
@@ -58,7 +59,7 @@ class CompletionScalaCliSuite extends BaseCompletionSuite:
5859 )
5960
6061 @ Test def `version` =
61- check (
62+ checkSubset (
6263 """ |//> using lib "io.circe::circe-core_sjs1:0.14.10@@"
6364 |package A
6465 |""" .stripMargin,
@@ -74,11 +75,12 @@ class CompletionScalaCliSuite extends BaseCompletionSuite:
7475 """ |//> using lib "io.circe::circe-core_sjs1:0.14.10"
7576 |package A
7677 |""" .stripMargin,
78+ filter = _.endsWith(" 0.14.10" )
7779 )
7880
7981 @ Ignore
8082 @ Test def `multiple-libs` =
81- check (
83+ checkSubset (
8284 """ |//> using lib "io.circe::circe-core:0.14.0", "io.circe::circe-core_na@@"
8385 |package A
8486 |""" .stripMargin,
@@ -87,7 +89,7 @@ class CompletionScalaCliSuite extends BaseCompletionSuite:
8789
8890 @ Ignore
8991 @ Test def `script` =
90- check (
92+ checkSubset (
9193 scriptWrapper(
9294 """ |//> using lib "io.circe:circe-core_na@@
9395 |
@@ -103,15 +105,15 @@ class CompletionScalaCliSuite extends BaseCompletionSuite:
103105 )
104106
105107 @ Test def `closing-quote` =
106- check (
108+ checkSubset (
107109 """ |//> using lib "io.circe::circe-core:0.14.0"@@
108110 |package A
109111 |""" .stripMargin,
110112 " "
111113 )
112114
113115 @ Test def `whitespace` =
114- check (
116+ checkSubset (
115117 """ |//> using lib "io.circe::circe-co @@
116118 |package A
117119 |""" .stripMargin,
@@ -130,7 +132,7 @@ class CompletionScalaCliSuite extends BaseCompletionSuite:
130132 )
131133
132134 @ Test def `dep` =
133- check (
135+ checkSubset (
134136 """ |//> using dep "io.cir@@
135137 |package A
136138 |""" .stripMargin,
@@ -140,13 +142,29 @@ class CompletionScalaCliSuite extends BaseCompletionSuite:
140142
141143 @ Ignore
142144 @ Test def `multiple-deps2` =
143- check (
145+ checkSubset (
144146 """ |//> using libs "io.circe::circe-core:0.14.0", "io.circe::circe-core_na@@"
145147 |package A
146148 |""" .stripMargin,
147149 " circe-core_native0.4"
148150 )
149151
152+ def checkSubset (
153+ original : String ,
154+ expected : String ,
155+ filename : String = " A.scala" ,
156+ enablePackageWrap : Boolean = true
157+ ) = {
158+ val expectedAtLeast = expected.linesIterator.toSet
159+ check(
160+ original,
161+ expected,
162+ filter = expectedAtLeast,
163+ filename = filename,
164+ enablePackageWrap = enablePackageWrap
165+ )
166+ }
167+
150168 private def scriptWrapper (code : String , filename : String ): String =
151169 // Vaguely looks like a scala file that ScalaCLI generates
152170 // from a sc file.
0 commit comments