@@ -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,
@@ -59,7 +60,7 @@ class CompletionScalaCliSuite extends BaseCompletionSuite:
59
60
60
61
@ Ignore
61
62
@ Test def `version` =
62
- check (
63
+ checkSubset (
63
64
""" |//> using lib "io.circe::circe-core_sjs1:0.14.10@@"
64
65
|package A
65
66
|""" .stripMargin,
@@ -76,11 +77,12 @@ class CompletionScalaCliSuite extends BaseCompletionSuite:
76
77
""" |//> using lib "io.circe::circe-core_sjs1:0.14.10"
77
78
|package A
78
79
|""" .stripMargin,
80
+ filter = _.endsWith(" 0.14.10" )
79
81
)
80
82
81
83
@ Ignore
82
84
@ Test def `multiple-libs` =
83
- check (
85
+ checkSubset (
84
86
""" |//> using lib "io.circe::circe-core:0.14.0", "io.circe::circe-core_na@@"
85
87
|package A
86
88
|""" .stripMargin,
@@ -89,7 +91,7 @@ class CompletionScalaCliSuite extends BaseCompletionSuite:
89
91
90
92
@ Ignore
91
93
@ Test def `script` =
92
- check (
94
+ checkSubset (
93
95
scriptWrapper(
94
96
""" |//> using lib "io.circe:circe-core_na@@
95
97
|
@@ -105,15 +107,15 @@ class CompletionScalaCliSuite extends BaseCompletionSuite:
105
107
)
106
108
107
109
@ Test def `closing-quote` =
108
- check (
110
+ checkSubset (
109
111
""" |//> using lib "io.circe::circe-core:0.14.0"@@
110
112
|package A
111
113
|""" .stripMargin,
112
114
" "
113
115
)
114
116
115
117
@ Test def `whitespace` =
116
- check (
118
+ checkSubset (
117
119
""" |//> using lib "io.circe::circe-co @@
118
120
|package A
119
121
|""" .stripMargin,
@@ -132,7 +134,7 @@ class CompletionScalaCliSuite extends BaseCompletionSuite:
132
134
)
133
135
134
136
@ Test def `dep` =
135
- check (
137
+ checkSubset (
136
138
""" |//> using dep "io.cir@@
137
139
|package A
138
140
|""" .stripMargin,
@@ -142,13 +144,29 @@ class CompletionScalaCliSuite extends BaseCompletionSuite:
142
144
143
145
@ Ignore
144
146
@ Test def `multiple-deps2` =
145
- check (
147
+ checkSubset (
146
148
""" |//> using libs "io.circe::circe-core:0.14.0", "io.circe::circe-core_na@@"
147
149
|package A
148
150
|""" .stripMargin,
149
151
" circe-core_native0.4"
150
152
)
151
153
154
+ def checkSubset (
155
+ original : String ,
156
+ expected : String ,
157
+ filename : String = " A.scala" ,
158
+ enablePackageWrap : Boolean = true
159
+ ) = {
160
+ val expectedAtLeast = expected.linesIterator.toSet
161
+ check(
162
+ original,
163
+ expected,
164
+ filter = expectedAtLeast,
165
+ filename = filename,
166
+ enablePackageWrap = enablePackageWrap
167
+ )
168
+ }
169
+
152
170
private def scriptWrapper (code : String , filename : String ): String =
153
171
// Vaguely looks like a scala file that ScalaCLI generates
154
172
// from a sc file.
0 commit comments