Skip to content

[test][SourceKit] Add a test to ensure sibling-based indentation work for arguments with trailing comments. rdar://27776466 #5828

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 17, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions test/SourceKit/CodeFormat/indent-sibling2.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ public func someTestFunc(withArgumentLabel label: String,
andAnotherArgumentLabel label3: String) {
}

func foo(x: Int, y: Int, z: Int) {}
func testFoo() {
foo(x: 1, // comment
y: 2,
z: 3)
}

// 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
Expand All @@ -56,6 +63,7 @@ public func someTestFunc(withArgumentLabel label: String,
// RUN: %sourcekitd-test -req=format -line=37 -length=1 %s >>%t.response
// RUN: %sourcekitd-test -req=format -line=41 -length=1 %s >>%t.response
// RUN: %sourcekitd-test -req=format -line=42 -length=1 %s >>%t.response
// RUN: %sourcekitd-test -req=format -line=48 -length=1 %s >>%t.response

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

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

// " someOtherArgumentLabel label2: String,"
// CHECK: key.sourcetext: " andAnotherArgumentLabel label3: String) {"

// " foo(x: 1, // comment"
// CHECK: key.sourcetext: " y: 2,"