Skip to content

Commit 6880afa

Browse files
committed
[test][SourceKit] Add a test to ensure sibling-based indentation work for arguments with trailing comments. rdar://27776466
The radar is no longer an issue after @bitjammer's change on preserving trivia on tokens.
1 parent 32feae5 commit 6880afa

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Diff for: test/SourceKit/CodeFormat/indent-sibling2.swift

+11
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ public func someTestFunc(withArgumentLabel label: String,
4242
andAnotherArgumentLabel label3: String) {
4343
}
4444

45+
func foo(x: Int, y: Int, z: Int) {}
46+
func testFoo() {
47+
foo(x: 1, // comment
48+
y: 2,
49+
z: 3)
50+
}
51+
4552
// RUN: %sourcekitd-test -req=format -line=6 -length=1 %s >%t.response
4653
// RUN: %sourcekitd-test -req=format -line=7 -length=1 %s >>%t.response
4754
// RUN: %sourcekitd-test -req=format -line=8 -length=1 %s >>%t.response
@@ -56,6 +63,7 @@ public func someTestFunc(withArgumentLabel label: String,
5663
// RUN: %sourcekitd-test -req=format -line=37 -length=1 %s >>%t.response
5764
// RUN: %sourcekitd-test -req=format -line=41 -length=1 %s >>%t.response
5865
// RUN: %sourcekitd-test -req=format -line=42 -length=1 %s >>%t.response
66+
// RUN: %sourcekitd-test -req=format -line=48 -length=1 %s >>%t.response
5967

6068
// RUN: %FileCheck --strict-whitespace %s <%t.response
6169

@@ -93,3 +101,6 @@ public func someTestFunc(withArgumentLabel label: String,
93101

94102
// " someOtherArgumentLabel label2: String,"
95103
// CHECK: key.sourcetext: " andAnotherArgumentLabel label3: String) {"
104+
105+
// " foo(x: 1, // comment"
106+
// CHECK: key.sourcetext: " y: 2,"

0 commit comments

Comments
 (0)