forked from swiftlang/swift-format
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run Windows tests dockerless (+13 squashed commits)
Squashed commits: [23709e8] Fix issue in publish_release pipeline testing swift-format in debug configuration [ce212ca] Use matrix to run debug and release [39ee6a2] Run Windows tests before tagging a release The GitHub workflows enabled Windows in the testing matrix. We needed to port the pre-build commands that apply the release commits to Windows to make the Windows checks pass. [8fec655] Use dockerless Windows jobs Dockerless Windows is 5-10 minutes faster than Docker on Windows [2cd032c] PrettyPrinter reports wrong line LineNumbersTests The reason for the wrong line number were multiline comments. In to accomodate for this, we now check the string while writing for new lines and increment the line count accordingly. Issue: swiftlang#882 [8c68ec3] Add indentBlankLines configuration [fee42c9] Add `--enable-experimental-feature` to enable those features in the parser. Also add a couple small tests for value generics to exercise the capability in tests. Fixes swiftlang#875. [5e4caa8] feat: add pre-commit hooks [e6aa9ec] Update UseShorthandTypeNames.swift [9cbc942] Update UseShorthandTypeNames.swift [dfb366a] Fix formatting [c3b0c9f] Prepare for integer generics with new generic argument node [211884f] Fix tests when building swift-format using Swift 6.0.2 When traversing the file URL with Foundation from Swift 6.0.2, you get the following components - `["/", "C:", "test.swift"]` - `["/", "C:"]` - `[]` The component count never reaches 1. Foundation from Swift 6.1 goes - `["/", "C:", "test.swift"]` - `["/", "C:"]` - `["/"]` Cover both cases by checking for `<= 1` instead of `== 1` Prepare for integer generics with new generic argument node Fix formatting Update UseShorthandTypeNames.swift Update UseShorthandTypeNames.swift feat: add pre-commit hooks Add `--enable-experimental-feature` to enable those features in the parser. Also add a couple small tests for value generics to exercise the capability in tests. Fixes swiftlang#875. Add indentBlankLines configuration PrettyPrinter reports wrong line LineNumbersTests The reason for the wrong line number were multiline comments. In to accomodate for this, we now check the string while writing for new lines and increment the line count accordingly. Issue: swiftlang#882 Use dockerless Windows jobs Dockerless Windows is 5-10 minutes faster than Docker on Windows Run Windows tests before tagging a release The GitHub workflows enabled Windows in the testing matrix. We needed to port the pre-build commands that apply the release commits to Windows to make the Windows checks pass. Use matrix to run debug and release Fix issue in publish_release pipeline testing swift-format in debug configuration Run Windows tests dockerless
- Loading branch information
Showing
6 changed files
with
181 additions
and
52 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import SwiftFormat | ||
import _SwiftFormatTestSupport | ||
|
||
final class LineNumbersTests: PrettyPrintTestCase { | ||
func testLineNumbers() { | ||
let input = | ||
""" | ||
final class A { | ||
@Test func b() throws { | ||
doSomethingInAFunctionWithAVeryLongName() 1️⃣// Here we have a very long comment that should not be here because it is far too long | ||
} | ||
} | ||
""" | ||
|
||
let expected = | ||
""" | ||
final class A { | ||
@Test func b() throws { | ||
doSomethingInAFunctionWithAVeryLongName() // Here we have a very long comment that should not be here because it is far too long | ||
} | ||
} | ||
""" | ||
|
||
assertPrettyPrintEqual( | ||
input: input, | ||
expected: expected, | ||
linelength: 120, | ||
whitespaceOnly: true, | ||
findings: [ | ||
FindingSpec("1️⃣", message: "move end-of-line comment that exceeds the line length") | ||
] | ||
) | ||
} | ||
|
||
func testLineNumbersWithComments() { | ||
let input = | ||
""" | ||
// Copyright (C) 2024 My Coorp. All rights reserved. | ||
// | ||
// This document is the property of My Coorp. | ||
// It is considered confidential and proprietary. | ||
// | ||
// This document may not be reproduced or transmitted in any form, | ||
// in whole or in part, without the express written permission of | ||
// My Coorp. | ||
final class A { | ||
@Test func b() throws { | ||
doSomethingInAFunctionWithAVeryLongName() 1️⃣// Here we have a very long comment that should not be here because it is far too long | ||
} | ||
} | ||
""" | ||
|
||
let expected = | ||
""" | ||
// Copyright (C) 2024 My Coorp. All rights reserved. | ||
// | ||
// This document is the property of My Coorp. | ||
// It is considered confidential and proprietary. | ||
// | ||
// This document may not be reproduced or transmitted in any form, | ||
// in whole or in part, without the express written permission of | ||
// My Coorp. | ||
final class A { | ||
@Test func b() throws { | ||
doSomethingInAFunctionWithAVeryLongName() // Here we have a very long comment that should not be here because it is far too long | ||
} | ||
} | ||
""" | ||
|
||
assertPrettyPrintEqual( | ||
input: input, | ||
expected: expected, | ||
linelength: 120, | ||
whitespaceOnly: true, | ||
findings: [ | ||
FindingSpec("1️⃣", message: "move end-of-line comment that exceeds the line length") | ||
] | ||
) | ||
} | ||
} |