Skip to content

Commit 876a0ee

Browse files
authored
Merge pull request swiftlang#36714 from rintaro/ide-completion-batchtest1
[CodeCompletion] Migrate some tests to batch completion test #1
2 parents c5b7208 + 1d28287 commit 876a0ee

6 files changed

+291
-765
lines changed

test/IDE/complete_after_self.swift

Lines changed: 14 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,5 @@
1-
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CONSTRUCTOR_SELF_NO_DOT_1 > %t.self.txt
2-
// RUN: %FileCheck %s -check-prefix=CONSTRUCTOR_SELF_NO_DOT_1 < %t.self.txt
3-
// RUN: %FileCheck %s -check-prefix=COMMON_SELF_NO_DOT_1 < %t.self.txt
4-
5-
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CONSTRUCTOR_NONSELF_NO_DOT_1 > %t.self.txt
6-
// RUN: %FileCheck %s -check-prefix=COMMON_SELF_NO_DOT_1 < %t.self.txt
7-
// RUN: %FileCheck %s -check-prefix=NO_INIT < %t.self.txt
8-
9-
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CONSTRUCTOR_SELF_DOT_1 > %t.self.txt
10-
// RUN: %FileCheck %s -check-prefix=CONSTRUCTOR_SELF_DOT_1 < %t.self.txt
11-
// RUN: %FileCheck %s -check-prefix=COMMON_SELF_DOT_1 < %t.self.txt
12-
13-
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CONVENIENCE_SELF_DOT_1 > %t.self.txt
14-
// RUN: %FileCheck %s -check-prefix=CONVENIENCE_SELF_DOT_1 < %t.self.txt
15-
// RUN: %FileCheck %s -check-prefix=COMMON_SELF_DOT_1 < %t.self.txt
16-
17-
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CONSTRUCTOR_NONSELF_DOT_1 > %t.self.txt
18-
// RUN: %FileCheck %s -check-prefix=COMMON_SELF_DOT_1 < %t.self.txt
19-
// RUN: %FileCheck %s -check-prefix=NO_INIT < %t.self.txt
20-
21-
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DESTRUCTOR_SELF_NO_DOT_1 > %t.self.txt
22-
// RUN: %FileCheck %s -check-prefix=DESTRUCTOR_SELF_NO_DOT_1 < %t.self.txt
23-
// RUN: %FileCheck %s -check-prefix=COMMON_SELF_NO_DOT_1 < %t.self.txt
24-
// RUN: %FileCheck %s -check-prefix=NO_INIT < %t.self.txt
25-
26-
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DESTRUCTOR_SELF_DOT_1 > %t.self.txt
27-
// RUN: %FileCheck %s -check-prefix=DESTRUCTOR_SELF_DOT_1 < %t.self.txt
28-
// RUN: %FileCheck %s -check-prefix=COMMON_SELF_DOT_1 < %t.self.txt
29-
// RUN: %FileCheck %s -check-prefix=NO_INIT < %t.self.txt
30-
31-
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FUNC_SELF_NO_DOT_1 > %t.self.txt
32-
// RUN: %FileCheck %s -check-prefix=FUNC_SELF_NO_DOT_1 < %t.self.txt
33-
// RUN: %FileCheck %s -check-prefix=COMMON_SELF_NO_DOT_1 < %t.self.txt
34-
// RUN: %FileCheck %s -check-prefix=NO_INIT < %t.self.txt
35-
36-
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STATIC_SELF_PAREN > %t.self.txt
37-
// RUN: %FileCheck %s -check-prefix=STATIC_SELF_PAREN < %t.self.txt
38-
39-
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FUNC_SELF_DOT_1 > %t.self.txt
40-
// RUN: %FileCheck %s -check-prefix=FUNC_SELF_DOT_1 < %t.self.txt
41-
// RUN: %FileCheck %s -check-prefix=COMMON_SELF_DOT_1 < %t.self.txt
42-
// RUN: %FileCheck %s -check-prefix=NO_INIT < %t.self.txt
43-
44-
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FUNC_STATIC_SELF_NO_DOT_1 > %t.self.txt
45-
// RUN: %FileCheck %s -check-prefix=FUNC_STATIC_SELF_NO_DOT_1 < %t.self.txt
46-
47-
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FUNC_STATIC_SELF_DOT_1 > %t.self.txt
48-
// RUN: %FileCheck %s -check-prefix=FUNC_STATIC_SELF_DOT_1 < %t.self.txt
49-
50-
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRUCT_CONSTRUCTOR_SELF_DOT_1 > %t.self.txt
51-
// RUN: %FileCheck %s -check-prefix=STRUCT_CONSTRUCTOR_SELF_DOT_1 < %t.self.txt
52-
53-
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRUCT_CONSTRUCTOR_NONSELF_DOT_1 > %t.self.txt
54-
// RUN: %FileCheck %s -check-prefix=NO_INIT < %t.self.txt
55-
56-
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXTENSION_CONSTRUCTOR_SELF_DOT_1 > %t.self.txt
57-
// RUN: %FileCheck %s -check-prefix=COMMON_SELF_DOT_1 < %t.self.txt
58-
// RUN: %FileCheck %s -check-prefix=EXTENSION_CONSTRUCTOR_SELF_DOT_1 < %t.self.txt
59-
60-
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRUCT_FUNC_SELF_DOT_1 > %t.self.txt
61-
// RUN: %FileCheck %s -check-prefix=NO_INIT < %t.self.txt
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-swift-ide-test -batch-code-completion -source-filename %s -filecheck %raw-FileCheck -completion-output-dir %t
623

634
//===---
645
//===--- Tests for code completion after 'self'.
@@ -176,26 +117,26 @@ class ThisDerived1 : ThisBase1 {
176117
// COMMON_SELF_DOT_1: End completions
177118

178119
init() {
179-
self#^CONSTRUCTOR_SELF_NO_DOT_1^#
120+
self#^CONSTRUCTOR_SELF_NO_DOT_1?check=CONSTRUCTOR_SELF_NO_DOT_1;check=COMMON_SELF_NO_DOT_1^#
180121
// CONSTRUCTOR_SELF_NO_DOT_1: Begin completions, 21 items
181122
// CONSTRUCTOR_SELF_NO_DOT_1-NOT: Decl[Constructor]
182123
// CONSTRUCTOR_SELF_NO_DOT_1: End completions
183124
let d: ThisDerived1
184-
d#^CONSTRUCTOR_NONSELF_NO_DOT_1^#
125+
d#^CONSTRUCTOR_NONSELF_NO_DOT_1?check=COMMON_SELF_NO_DOT_1;check=NO_INIT^#
185126
// NO_INIT-NOT: init()
186127
}
187128

188129
init(a: Int) {
189-
self.#^CONSTRUCTOR_SELF_DOT_1^#
130+
self.#^CONSTRUCTOR_SELF_DOT_1?check=CONSTRUCTOR_SELF_DOT_1;check=COMMON_SELF_DOT_1^#
190131
// CONSTRUCTOR_SELF_DOT_1: Begin completions, 16 items
191132
// CONSTRUCTOR_SELF_DOT_1-NOT: Decl[Constructor]
192133
// CONSTRUCTOR_SELF_DOT_1: End completions
193134
let d: ThisDerived1
194-
d.#^CONSTRUCTOR_NONSELF_DOT_1^#
135+
d.#^CONSTRUCTOR_NONSELF_DOT_1?check=COMMON_SELF_DOT_1;check=NO_INIT^#
195136
}
196137

197138
convenience init(conv: Int) {
198-
self.#^CONVENIENCE_SELF_DOT_1^#
139+
self.#^CONVENIENCE_SELF_DOT_1?check=CONVENIENCE_SELF_DOT_1;check=COMMON_SELF_DOT_1^#
199140
// CONVENIENCE_SELF_DOT_1: Begin completions, 20 items
200141
// CONVENIENCE_SELF_DOT_1-DAG: Decl[Constructor]/CurrNominal: init()[#ThisDerived1#]; name=init()
201142
// CONVENIENCE_SELF_DOT_1-DAG: Decl[Constructor]/CurrNominal: init({#a: Int#})[#ThisDerived1#]; name=init(a: Int)
@@ -204,23 +145,23 @@ class ThisDerived1 : ThisBase1 {
204145
}
205146

206147
deinit {
207-
self#^DESTRUCTOR_SELF_NO_DOT_1^#
148+
self#^DESTRUCTOR_SELF_NO_DOT_1?check=DESTRUCTOR_SELF_NO_DOT_1;check=COMMON_SELF_NO_DOT_1;check=NO_INIT^#
208149
// DESTRUCTOR_SELF_NO_DOT_1: Begin completions, 21 items
209150
// DESTRUCTOR_SELF_NO_DOT_1: End completions
210151

211-
self.#^DESTRUCTOR_SELF_DOT_1^#
152+
self.#^DESTRUCTOR_SELF_DOT_1?check=DESTRUCTOR_SELF_DOT_1;check=COMMON_SELF_DOT_1;check=NO_INIT^#
212153
// DESTRUCTOR_SELF_DOT_1: Begin completions, 16 items
213154
// DESTRUCTOR_SELF_DOT_1: End completions
214155
}
215156

216157
func test1() {
217-
self#^FUNC_SELF_NO_DOT_1^#
158+
self#^FUNC_SELF_NO_DOT_1?check=FUNC_SELF_NO_DOT_1;check=COMMON_SELF_NO_DOT_1;check=NO_INIT^#
218159
// FUNC_SELF_NO_DOT_1: Begin completions, 21 items
219160
// FUNC_SELF_NO_DOT_1: End completions
220161
}
221162

222163
func test2() {
223-
self.#^FUNC_SELF_DOT_1^#
164+
self.#^FUNC_SELF_DOT_1?check=FUNC_SELF_DOT_1;check=COMMON_SELF_DOT_1;check=NO_INIT^#
224165
// FUNC_SELF_DOT_1: Begin completions, 16 items
225166
// FUNC_SELF_DOT_1: End completions
226167
}
@@ -329,7 +270,7 @@ extension ThisDerived1 {
329270
typealias DerivedExtNestedTypealias = Int
330271

331272
convenience init(someExtensionArg: Int) {
332-
self.#^EXTENSION_CONSTRUCTOR_SELF_DOT_1^#
273+
self.#^EXTENSION_CONSTRUCTOR_SELF_DOT_1?check=COMMON_SELF_DOT_1;check=EXTENSION_CONSTRUCTOR_SELF_DOT_1^#
333274
// EXTENSION_CONSTRUCTOR_SELF_DOT_1: Begin completions, 20 items
334275
// EXTENSION_CONSTRUCTOR_SELF_DOT_1: Decl[Constructor]/CurrNominal: init()[#ThisDerived1#]; name=init()
335276
// EXTENSION_CONSTRUCTOR_SELF_DOT_1: Decl[Constructor]/CurrNominal: init({#a: Int#})[#ThisDerived1#]; name=init(a: Int)
@@ -350,9 +291,9 @@ struct S1 {
350291
// STRUCT_CONSTRUCTOR_SELF_DOT_1-DAG: Decl[InstanceMethod]/CurrNominal: f()[#Void#]; name=f()
351292
// STRUCT_CONSTRUCTOR_SELF_DOT_1: End completions
352293
let s: S1
353-
s.#^STRUCT_CONSTRUCTOR_NONSELF_DOT_1^#
294+
s.#^STRUCT_CONSTRUCTOR_NONSELF_DOT_1?check=NO_INIT^#
354295
}
355296
func f() {
356-
self.#^STRUCT_FUNC_SELF_DOT_1^#
297+
self.#^STRUCT_FUNC_SELF_DOT_1?check=NO_INIT^#
357298
}
358299
}

0 commit comments

Comments
 (0)