Files
swift-mirror/test/SourceKit/CodeFormat/indent-bracestmt3-if-else.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

31 lines
1.1 KiB
Swift

func foo() {
var abc = 1
if abc == 1 {
abc = 2
}
else if abc == 2 {
abc = 3
} else {
abc = 3
}
}
// 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=9 -length=1 %s >>%t.response
// RUN: %sourcekitd-test -req=format -line=10 -length=1 %s >>%t.response
// RUN: FileCheck --strict-whitespace %s <%t.response
// CHECK: key.sourcetext: " if abc == 1 {"
// CHECK: key.sourcetext: " abc = 2"
// CHECK: key.sourcetext: " }"
// CHECK: key.sourcetext: " else if abc == 2 {"
// CHECK: key.sourcetext: " abc = 3"
// CHECK: key.sourcetext: " } else {"
// CHECK: key.sourcetext: " abc = 3"
// CHECK: key.sourcetext: " }"