@@ -10,15 +10,15 @@ class InstanceMemberTest : SingleFileTestFixture("completions", "InstanceMember.
10
10
val completions = languageServer.textDocumentService.completion(completionParams(file, 3 , 15 )).get().right!!
11
11
val labels = completions.items.map { it.label }
12
12
13
- assertThat(labels, hasItem(" instanceFoo" ))
14
- assertThat(labels, hasItem(" extensionFoo" ))
15
- assertThat(labels, hasItem(" fooVar" ))
16
- assertThat(labels, not (hasItem(" privateInstanceFoo" )))
17
- assertThat(labels, not (hasItem(" getFooVar" )))
18
- assertThat(labels, not (hasItem(" setFooVar" )))
13
+ assertThat(labels, hasItem(startsWith( " instanceFoo" ) ))
14
+ assertThat(labels, hasItem(startsWith( " extensionFoo" ) ))
15
+ assertThat(labels, hasItem(startsWith( " fooVar" ) ))
16
+ assertThat(labels, not (hasItem(startsWith( " privateInstanceFoo" ) )))
17
+ assertThat(labels, not (hasItem(startsWith( " getFooVar" ) )))
18
+ assertThat(labels, not (hasItem(startsWith( " setFooVar" ) )))
19
19
20
- assertThat(" Reports instanceFoo only once" , completions.items.filter { it.label == " instanceFoo" }, hasSize(1 ))
21
- assertThat(" Reports extensionFoo only once" , completions.items.filter { it.label == " extensionFoo" }, hasSize(1 ))
20
+ assertThat(" Reports instanceFoo only once" , completions.items.filter { it.label.startsWith( " instanceFoo" ) }, hasSize(1 ))
21
+ assertThat(" Reports extensionFoo only once" , completions.items.filter { it.label.startsWith( " extensionFoo" ) }, hasSize(1 ))
22
22
}
23
23
24
24
@Test fun `find count extension function` () {
@@ -32,28 +32,28 @@ class InstanceMemberTest : SingleFileTestFixture("completions", "InstanceMember.
32
32
val completions = languageServer.textDocumentService.completion(completionParams(file, 13 , 16 )).get().right!!
33
33
val labels = completions.items.map { it.label }
34
34
35
- assertThat(labels, hasItem(" instanceFoo" ))
35
+ assertThat(labels, hasItem(startsWith( " instanceFoo" ) ))
36
36
// assertThat(labels, not(hasItem("extensionFoo"))) Kotlin will probably implement this later
37
- assertThat(labels, hasItem(" fooVar" ))
38
- assertThat(labels, not (hasItem(" privateInstanceFoo" )))
39
- assertThat(labels, not (hasItem(" getFooVar" )))
40
- assertThat(labels, not (hasItem(" setFooVar" )))
37
+ assertThat(labels, hasItem(startsWith( " fooVar" ) ))
38
+ assertThat(labels, not (hasItem(startsWith( " privateInstanceFoo" ) )))
39
+ assertThat(labels, not (hasItem(startsWith( " getFooVar" ) )))
40
+ assertThat(labels, not (hasItem(startsWith( " setFooVar" ) )))
41
41
42
- assertThat(completions.items.filter { it.label == " instanceFoo" }.firstOrNull(), hasProperty(" insertText" , equalTo(" instanceFoo" )))
42
+ assertThat(completions.items.filter { it.label.startsWith( " instanceFoo" ) }.firstOrNull(), hasProperty(" insertText" , equalTo(" instanceFoo" )))
43
43
}
44
44
45
45
@Test fun `complete unqualified function reference` () {
46
46
val completions = languageServer.textDocumentService.completion(completionParams(file, 17 , 8 )).get().right!!
47
47
val labels = completions.items.map { it.label }
48
48
49
- assertThat(labels, hasItem(" findFunctionReference" ))
49
+ assertThat(labels, hasItem(startsWith( " findFunctionReference" ) ))
50
50
}
51
51
52
52
@Test fun `complete a function name within a call` () {
53
53
val completions = languageServer.textDocumentService.completion(completionParams(file, 22 , 27 )).get().right!!
54
54
val labels = completions.items.map { it.label }
55
55
56
- assertThat(labels, hasItem(" findFunctionReference" ))
56
+ assertThat(labels, hasItem(startsWith( " findFunctionReference" ) ))
57
57
assertThat(labels, not (hasItem(" instanceFoo" )))
58
58
}
59
59
}
@@ -73,19 +73,20 @@ class FunctionScopeTest : SingleFileTestFixture("completions", "FunctionScope.kt
73
73
val completions = languageServer.textDocumentService.completion(completionParams(file, 4 , 10 )).get().right!!
74
74
val labels = completions.items.map { it.label }
75
75
76
+ println (" ok lol" + labels.toString())
76
77
assertThat(labels, hasItem(" anArgument" ))
77
78
assertThat(labels, hasItem(" aLocal" ))
78
79
assertThat(labels, hasItem(" aClassVal" ))
79
- assertThat(labels, hasItem(" aClassFun" ))
80
+ assertThat(labels, hasItem(startsWith( " aClassFun" ) ))
80
81
assertThat(labels, hasItem(" aCompanionVal" ))
81
- assertThat(labels, hasItem(" aCompanionFun" ))
82
+ assertThat(labels, hasItem(startsWith( " aCompanionFun" ) ))
82
83
83
84
assertThat(" Reports anArgument only once" , completions.items.filter { it.label == " anArgument" }, hasSize(1 ))
84
85
assertThat(" Reports aLocal only once" , completions.items.filter { it.label == " aLocal" }, hasSize(1 ))
85
86
assertThat(" Reports aClassVal only once" , completions.items.filter { it.label == " aClassVal" }, hasSize(1 ))
86
- assertThat(" Reports aClassFun only once" , completions.items.filter { it.label == " aClassFun" }, hasSize(1 ))
87
+ assertThat(" Reports aClassFun only once" , completions.items.filter { it.label.startsWith( " aClassFun" ) }, hasSize(1 ))
87
88
assertThat(" Reports aCompanionVal only once" , completions.items.filter { it.label == " aCompanionVal" }, hasSize(1 ))
88
- assertThat(" Reports aCompanionFun only once" , completions.items.filter { it.label == " aCompanionFun" }, hasSize(1 ))
89
+ assertThat(" Reports aCompanionFun only once" , completions.items.filter { it.label.startsWith( " aCompanionFun" ) }, hasSize(1 ))
89
90
}
90
91
}
91
92
@@ -109,7 +110,7 @@ class FillEmptyBodyTest : SingleFileTestFixture("completions", "FillEmptyBody.kt
109
110
val completions = languageServer.textDocumentService.completion(completionParams(file, 3 , 20 )).get().right!!
110
111
val labels = completions.items.map { it.label }
111
112
112
- assertThat(labels, hasItem(" bar" ))
113
+ assertThat(labels, hasItem(startsWith( " bar" ) ))
113
114
}
114
115
}
115
116
@@ -127,7 +128,7 @@ class MiddleOfFunctionTest : SingleFileTestFixture("completions", "MiddleOfFunct
127
128
val completions = languageServer.textDocumentService.completion(completionParams(file, 3 , 11 )).get().right!!
128
129
val labels = completions.items.map { it.label }
129
130
130
- assertThat(labels, hasItem(" subSequence" ))
131
+ assertThat(labels, hasItem(startsWith( " subSequence" ) ))
131
132
}
132
133
}
133
134
@@ -145,28 +146,28 @@ class CompleteStaticsTest : SingleFileTestFixture("completions", "Statics.kt") {
145
146
val completions = languageServer.textDocumentService.completion(completionParams(file, 4 , 16 )).get().right!!
146
147
val labels = completions.items.map { it.label }
147
148
148
- assertThat(labels, hasItem(" isNull" ))
149
+ assertThat(labels, hasItem(startsWith( " isNull" ) ))
149
150
}
150
151
151
152
@Test fun `java static method reference` () {
152
153
val completions = languageServer.textDocumentService.completion(completionParams(file, 7 , 17 )).get().right!!
153
154
val labels = completions.items.map { it.label }
154
155
155
- assertThat(labels, hasItem(" isNull" ))
156
+ assertThat(labels, hasItem(startsWith( " isNull" ) ))
156
157
}
157
158
158
159
@Test fun `object method` () {
159
160
val completions = languageServer.textDocumentService.completion(completionParams(file, 5 , 17 )).get().right!!
160
161
val labels = completions.items.map { it.label }
161
162
162
- assertThat(labels, hasItem(" objectFun" ))
163
+ assertThat(labels, hasItem(startsWith( " objectFun" ) ))
163
164
}
164
165
165
166
@Test fun `companion object method` () {
166
167
val completions = languageServer.textDocumentService.completion(completionParams(file, 6 , 16 )).get().right!!
167
168
val labels = completions.items.map { it.label }
168
169
169
- assertThat(labels, hasItem(" companionFun" ))
170
+ assertThat(labels, hasItem(startsWith( " companionFun" ) ))
170
171
}
171
172
}
172
173
@@ -175,9 +176,9 @@ class VisibilityTest : SingleFileTestFixture("completions", "Visibility.kt") {
175
176
val completions = languageServer.textDocumentService.completion(completionParams(file, 3 , 10 )).get().right!!
176
177
val labels = completions.items.map { it.label }
177
178
178
- assertThat(labels, hasItems(" privateThisFun" , " protectedThisFun" , " publicThisFun" , " privateThisCompanionFun" , " protectedThisCompanionFun" , " publicThisCompanionFun" , " privateTopLevelFun" ))
179
- assertThat(labels, hasItems(" protectedSuperFun" , " publicSuperFun" , " protectedSuperCompanionFun" , " publicSuperCompanionFun" ))
180
- assertThat(labels, not (hasItems(" privateSuperFun" , " privateSuperCompanionFun" , " publicExtensionFun" )))
179
+ assertThat(labels, hasItems(startsWith( " privateThisFun" ), startsWith( " protectedThisFun" ), startsWith( " publicThisFun" ), startsWith( " privateThisCompanionFun" ), startsWith( " protectedThisCompanionFun" ), startsWith( " publicThisCompanionFun" ), startsWith( " privateTopLevelFun" ) ))
180
+ assertThat(labels, hasItems(startsWith( " protectedSuperFun" ), startsWith( " publicSuperFun" ), startsWith( " protectedSuperCompanionFun" ), startsWith( " publicSuperCompanionFun" ) ))
181
+ assertThat(labels, not (hasItems(startsWith( " privateSuperFun" ), startsWith( " privateSuperCompanionFun" ), startsWith( " publicExtensionFun" ) )))
181
182
}
182
183
}
183
184
@@ -210,7 +211,7 @@ class DoubleDotTest : SingleFileTestFixture("completions", "DoubleDot.kt") {
210
211
val labels = completions.items.map { it.label }
211
212
212
213
assertThat(labels, not (hasItem(" chars" )))
213
- assertThat(labels, hasItem(" anyMatch" ))
214
+ assertThat(labels, hasItem(startsWith( " anyMatch" ) ))
214
215
}
215
216
}
216
217
@@ -219,7 +220,7 @@ class QuestionDotTest : SingleFileTestFixture("completions", "QuestionDot.kt") {
219
220
val completions = languageServer.textDocumentService.completion(completionParams(file, 2 , 8 )).get().right!!
220
221
val labels = completions.items.map { it.label }
221
222
222
- assertThat(labels, hasItem(" chars" ))
223
+ assertThat(labels, hasItem(startsWith( " chars" ) ))
223
224
}
224
225
}
225
226
@@ -244,7 +245,7 @@ class EditCallTest : SingleFileTestFixture("completions", "EditCall.kt") {
244
245
val completions = languageServer.textDocumentService.completion(completionParams(file, 2 , 11 )).get().right!!
245
246
val labels = completions.items.map { it.label }
246
247
247
- assertThat(labels, hasItem(" println" ))
248
- assertThat(completions.items.filter { it.label == " println" }.firstOrNull(), hasProperty(" insertText" , equalTo(" println" )))
248
+ assertThat(labels, hasItem(startsWith( " println" ) ))
249
+ assertThat(completions.items.filter { it.label.startsWith( " println" ) }.firstOrNull(), hasProperty(" insertText" , equalTo(" println" )))
249
250
}
250
251
}
0 commit comments