Skip to content

Commit b918345

Browse files
author
Simon Barinka
committed
[SourceKit] Add tests
1 parent b13a7f5 commit b918345

File tree

2 files changed

+689
-0
lines changed

2 files changed

+689
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// RUN: %sourcekitd-test -req=index -req-opts=should_index_locals=1 %s -- -Xfrontend -serialize-diagnostics-path -Xfrontend %t.dia -Xfrontend -disable-implicit-concurrency-module-import -Xfrontend -disable-implicit-string-processing-module-import %s | %sed_clean > %t.response
2+
// RUN: %diff -u %s.response %t.response
3+
4+
func foo(a: Int, b: Double) {
5+
var locVar = 1
6+
}
7+
8+
var globalVar = 2
9+
10+
class A : ExpressibleByIntegerLiteral {
11+
required init(integerLiteral value: IntegerLiteralType) {}
12+
}
13+
14+
func bar() {
15+
var locVar1: A = 1
16+
let locVar2 = 2
17+
foo(a: globalVar, b: Double(locVar2))
18+
let closure = { (arg1: Int, arg2: Int) -> Int in
19+
let locVar3 = 3
20+
let expr: Int = locVar2 + globalVar + arg1
21+
return expr
22+
}
23+
}
24+
25+
class X {
26+
func baz() {
27+
func inner(_ x: Int) -> Int { return x }
28+
var arr: [Int] = [1, 2, 3]
29+
if (globalVar > 2) {
30+
arr = arr.map { inner($0) }
31+
}
32+
}
33+
}

0 commit comments

Comments
 (0)