@@ -8,7 +8,7 @@ import org.junit.Ignore
8
8
class CompletionScalaCliSuite extends BaseCompletionSuite :
9
9
10
10
@ Test def `simple` =
11
- check (
11
+ checkSubset (
12
12
""" |//> using lib "io.cir@@
13
13
|package A
14
14
|""" .stripMargin,
@@ -30,24 +30,25 @@ class CompletionScalaCliSuite extends BaseCompletionSuite:
30
30
|//> using lib io.circe::circe-core_native0.4
31
31
|package A
32
32
|""" .stripMargin,
33
- assertSingleItem = false
33
+ assertSingleItem = false ,
34
+ filter = _.contains(" circe-core_native0.4" )
34
35
)
35
36
36
37
@ Test def `version-sort` =
37
- check (
38
+ checkSubset (
38
39
""" |//> using dep "com.lihaoyi::pprint:0.7@@"
39
40
|package A
40
41
|""" .stripMargin,
41
42
""" |0.7.3
42
43
|0.7.2
43
44
|0.7.1
44
45
|0.7.0
45
- |""" .stripMargin,
46
+ |""" .stripMargin
46
47
)
47
48
48
49
@ Ignore
49
50
@ Test def `single-colon` =
50
- check (
51
+ checkSubset (
51
52
""" |//> using lib "io.circe:circe-core_na@@
52
53
|package A
53
54
|""" .stripMargin,
@@ -58,7 +59,7 @@ class CompletionScalaCliSuite extends BaseCompletionSuite:
58
59
)
59
60
60
61
@ Test def `version` =
61
- check (
62
+ checkSubset (
62
63
""" |//> using lib "io.circe::circe-core_sjs1:0.14.10@@"
63
64
|package A
64
65
|""" .stripMargin,
@@ -74,11 +75,12 @@ class CompletionScalaCliSuite extends BaseCompletionSuite:
74
75
""" |//> using lib "io.circe::circe-core_sjs1:0.14.10"
75
76
|package A
76
77
|""" .stripMargin,
78
+ filter = _.endsWith(" 0.14.10" )
77
79
)
78
80
79
81
@ Ignore
80
82
@ Test def `multiple-libs` =
81
- check (
83
+ checkSubset (
82
84
""" |//> using lib "io.circe::circe-core:0.14.0", "io.circe::circe-core_na@@"
83
85
|package A
84
86
|""" .stripMargin,
@@ -87,7 +89,7 @@ class CompletionScalaCliSuite extends BaseCompletionSuite:
87
89
88
90
@ Ignore
89
91
@ Test def `script` =
90
- check (
92
+ checkSubset (
91
93
scriptWrapper(
92
94
""" |//> using lib "io.circe:circe-core_na@@
93
95
|
@@ -103,15 +105,15 @@ class CompletionScalaCliSuite extends BaseCompletionSuite:
103
105
)
104
106
105
107
@ Test def `closing-quote` =
106
- check (
108
+ checkSubset (
107
109
""" |//> using lib "io.circe::circe-core:0.14.0"@@
108
110
|package A
109
111
|""" .stripMargin,
110
112
" "
111
113
)
112
114
113
115
@ Test def `whitespace` =
114
- check (
116
+ checkSubset (
115
117
""" |//> using lib "io.circe::circe-co @@
116
118
|package A
117
119
|""" .stripMargin,
@@ -130,7 +132,7 @@ class CompletionScalaCliSuite extends BaseCompletionSuite:
130
132
)
131
133
132
134
@ Test def `dep` =
133
- check (
135
+ checkSubset (
134
136
""" |//> using dep "io.cir@@
135
137
|package A
136
138
|""" .stripMargin,
@@ -140,13 +142,29 @@ class CompletionScalaCliSuite extends BaseCompletionSuite:
140
142
141
143
@ Ignore
142
144
@ Test def `multiple-deps2` =
143
- check (
145
+ checkSubset (
144
146
""" |//> using libs "io.circe::circe-core:0.14.0", "io.circe::circe-core_na@@"
145
147
|package A
146
148
|""" .stripMargin,
147
149
" circe-core_native0.4"
148
150
)
149
151
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
+
150
168
private def scriptWrapper (code : String , filename : String ): String =
151
169
// Vaguely looks like a scala file that ScalaCLI generates
152
170
// from a sc file.
0 commit comments