Files
swift-mirror/test/SourceKit/CodeFormat/indent-closure.swift
Argyrios Kyrtzidis 8ff6a98a99 [sourcekit] Merge SourceKit into the Swift repo.
The code goes into its own sub-tree under 'tools' but tests go under 'test',
so that running 'check-swift' will also run all the SourceKit tests.

SourceKit is disabled on non-darwin platforms.
2015-11-05 01:09:08 -08:00

47 lines
1.4 KiB
Swift

func foo() {
bar() {
var abc = 1
let a: String = {
let b = "asdf"
return b
}()
}
}
class C {
private static let durationTimeFormatter: NSDateComponentsFormatter = {
return timeFormatter
}()
}
func foo1(a: Int, handler : ()->()) {}
func foo2(handler : () ->()) {}
func foo3() {
foo1(1)
{
}
}
// RUN: %sourcekitd-test -req=format -line=3 -length=1 %s >%t.response
// RUN: %sourcekitd-test -req=format -line=4 -length=1 %s >>%t.response
// RUN: %sourcekitd-test -req=format -line=5 -length=1 %s >>%t.response
// RUN: %sourcekitd-test -req=format -line=6 -length=1 %s >>%t.response
// RUN: %sourcekitd-test -req=format -line=7 -length=1 %s >>%t.response
// RUN: %sourcekitd-test -req=format -line=8 -length=1 %s >>%t.response
// RUN: %sourcekitd-test -req=format -line=14 -length=1 %s >>%t.response
// RUN: %sourcekitd-test -req=format -line=22 -length=1 %s >>%t.response
// RUN: FileCheck --strict-whitespace %s <%t.response
// CHECK: key.sourcetext: " var abc = 1"
// CHECK: key.sourcetext: " let a: String = {"
// CHECK: key.sourcetext: " let b = "asdf""
// CHECK: key.sourcetext: " return b"
// CHECK: key.sourcetext: " }()"
// CHECK: key.sourcetext: " }"
// " private static let durationTimeFormatter: NSDateComponentsFormatter = {"
// CHECK: key.sourcetext: " }()"
// " foo1(1)"
// CHECK: key.sourcetext: " {"