Skip to content

Commit 2160134

Browse files
committed
[SourceKit] Add test file for fast completion
1 parent c3d5828 commit 2160134

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
class Foo {
2+
var x: Int
3+
var y: Int
4+
func fooMethod() {}
5+
}
6+
struct Bar {
7+
var a: Int
8+
var b: Int
9+
func barMethod() {}
10+
}
11+
func foo(arg: Foo) {
12+
_ = arg.
13+
}
14+
func bar(arg: Bar) {
15+
_ = arg.
16+
}
17+
18+
// NOTE: Tests for 'key.codecomplete.reuseastcontex' option.
19+
20+
// RUN: %sourcekitd-test \
21+
// RUN: -req=track-compiles == \
22+
// RUN: -req=complete -pos=12:11 %s -- %s == \
23+
// RUN: -req=complete -pos=15:11 %s -- %s > %t.response
24+
// RUN: %FileCheck --check-prefix=RESULT %s < %t.response
25+
// RUN: %FileCheck --check-prefix=TRACE_NORMAL %s < %t.response
26+
27+
// RUN: %sourcekitd-test \
28+
// RUN: -req=track-compiles == \
29+
// RUN: -req=complete -req-opts=reuseastcontext=1 -pos=12:11 %s -- %s == \
30+
// RUN: -req=complete -req-opts=reuseastcontext=1 -pos=15:11 %s -- %s > %t.response.reuseastcontext
31+
// RUN: %FileCheck --check-prefix=RESULT %s < %t.response.reuseastcontext
32+
// RUN: %FileCheck --check-prefix=TRACE_REUSEAST %s < %t.response.reuseastcontext
33+
34+
// RESULT-LABEL: key.results: [
35+
// RESULT-DAG: key.name: "fooMethod()"
36+
// RESULT-DAG: key.name: "self"
37+
// RESULT-DAG: key.name: "x"
38+
// RESULT-DAG: key.name: "y"
39+
// RESULT: ]
40+
// RESULT-LABEL: key.results: [
41+
// RESULT-DAG: key.name: "barMethod()"
42+
// RESULT-DAG: key.name: "self"
43+
// RESULT-DAG: key.name: "a"
44+
// RESULT-DAG: key.name: "b"
45+
// RESULT: ]
46+
47+
// TRACE_NORMAL-LABEL: key.notification: source.notification.compile-did-finish,
48+
// TRACE_NORMAL-NOT: key.description: "completion reusing previous ASTContext (benign diagnostic)"
49+
// TRACE_NORMAL-LABEL: key.notification: source.notification.compile-did-finish,
50+
// TRACE_NORMAL-NOT: key.description: "completion reusing previous ASTContext (benign diagnostic)"
51+
52+
// TRACE_REUSEAST-LABEL: key.notification: source.notification.compile-did-finish,
53+
// TRACE_REUSEAST-NOT: key.description: "completion reusing previous ASTContext (benign diagnostic)"
54+
// TRACE_REUSEAST-LABEL: key.notification: source.notification.compile-did-finish,
55+
// TRACE_REUSEAST: key.description: "completion reusing previous ASTContext (benign diagnostic)"

0 commit comments

Comments
 (0)