Skip to content

Fix new package XCTest file formatting and include throws keyword #3448

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

Conversation

stmontgomery
Copy link
Contributor

Motivation: Fix formatting of the XCTest source file in newly init'ed library packages, and include the
throws keyword on the example XCTest method as a convenience to users and to promote use of throwing
XCTest methods.

Changes:

  • Fix a bug in the formatting of XCTest source files in InitPackage, where the closing """ string
    terminator was outdented one level too far, which resulted in the file contents being indented unnecessarily.
  • Include the throws keyword on func testExample() in the new Library type package template.
  • Modify an existing test to validate these improvements.

rdar://77209458
rdar://77209464

Motivation: Fix formatting of the XCTest source file in newly `init`'ed packages, and include the
`throws` keyword on the example XCTest method as a convenience to users and to promote use of throwing
test methods in XCTests.

Changes:
- Fix a bug in the formatting of XCTest source files in `InitPackage`, where the closing `"""` string
  terminator was outdented one level too far, which resulted in the file contents being indented unnecessarily.
- Include the `throws` keyword on `func testExample()` in the new Library type package template.
- Modify an existing test to validate these improvements.

rdar://77209458
rdar://77209464
@stmontgomery
Copy link
Contributor Author

@swift-ci please test

@stmontgomery
Copy link
Contributor Author

@swift-ci please smoke test

Copy link
Contributor

@neonichu neonichu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@neonichu
Copy link
Contributor

Looks like there's something broken in swift-driver?

/Users/buildnode/jenkins/workspace/swift-package-manager-with-xcode-self-hosted-PR-osx/branch-main/swiftpm/.build/checkouts/swift-driver/Sources/SwiftDriver/Jobs/Planning.swift:188:31: error: variable used within its own initial value

cc @artemcm

@artemcm
Copy link
Contributor

artemcm commented Apr 27, 2021

@swift-ci please smoke test macOS platform

@artemcm
Copy link
Contributor

artemcm commented Apr 27, 2021

Sorry, this was due to compiler version mismatch between swift-driver CI and self-hosted SwiftPM CI.
Patched in: swiftlang/swift-driver#617

@tomerd
Copy link
Contributor

tomerd commented Apr 27, 2021

@stmontgomery thanks for this! please note we would need another cherry-pick PR into release/5.5 if you want to include this in 5.5

@stmontgomery stmontgomery merged commit e3cefa5 into swiftlang:main Apr 27, 2021
@stmontgomery stmontgomery deleted the test-file-template-fixes-77209458-77209464 branch April 27, 2021 18:24
stmontgomery added a commit to stmontgomery/swift-package-manager that referenced this pull request Apr 27, 2021
…iftlang#3448)

Motivation: Fix formatting of the XCTest source file in newly `init`'ed packages, and include the
`throws` keyword on the example XCTest method as a convenience to users and to promote use of throwing
test methods in XCTests.

Changes:
- Fix a bug in the formatting of XCTest source files in `InitPackage`, where the closing `"""` string
  terminator was outdented one level too far, which resulted in the file contents being indented unnecessarily.
- Include the `throws` keyword on `func testExample()` in the new Library type package template.
- Modify an existing test to validate these improvements.

rdar://77209458
rdar://77209464
stmontgomery added a commit that referenced this pull request Apr 27, 2021
) (#3449)

Motivation: Fix formatting of the XCTest source file in newly `init`'ed packages, and include the
`throws` keyword on the example XCTest method as a convenience to users and to promote use of throwing
test methods in XCTests.

Changes:
- Fix a bug in the formatting of XCTest source files in `InitPackage`, where the closing `"""` string
  terminator was outdented one level too far, which resulted in the file contents being indented unnecessarily.
- Include the `throws` keyword on `func testExample()` in the new Library type package template.
- Modify an existing test to validate these improvements.

rdar://77209458
rdar://77209464
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants