-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Fixup several warnings #9009
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
base: main
Are you sure you want to change the base?
Fixup several warnings #9009
Conversation
- Remove unnecessary `try` statements for function calls that do not throw - Remove unnecessary `#expect` checks for values that cannot be `nil`
6625710
to
df13ad4
Compare
@swift-ci test |
3e6cd06
to
4855cdd
Compare
@swift-ci test |
@swift-ci test |
@swift-ci please test windows |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the cleanup. I have some comments, which some possibly being blocking.
@@ -13,6 +13,7 @@ | |||
import SourceControl | |||
|
|||
import class Basics.AsyncProcess | |||
import class TSCBasic.Process |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: can we use AsyncProcess
that is located in SwiftPM instead of having to rely on a TSC API?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switching from Process.checkNonZeroExit
to AsyncProcess.checkNonZeroExit
would require many methods to be converted to async
. While probably worthwhile, it would would be best addressed in a standalone PR.
@@ -193,7 +193,6 @@ public enum TestError: Error { | |||
case platformNotSupported | |||
} | |||
|
|||
@available(*, deprecated, message: "Migrate test to Swift Testing and use 'fixture' instead") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: Please reading this as we want to to encourage contributor to migrate away from XCTest when they touch a test file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's adding quite a bit of noise to test builds, but I can add it back.
@@ -32,12 +32,12 @@ import Testing | |||
import func XCTest.XCTFail | |||
import struct XCTest.XCTSkip | |||
|
|||
import class TSCBasic.Process |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: Can we use AsyncProcess
located in SwiftPM instead of depending on a TSC API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would require marking the utility method as async and then cascading that across all its usages. Probably worth doing, but in a separate patch
for case let url as URL in enumerator where url.lastPathComponent == "Bar.symbols.json" { | ||
symbolGraphURL = url | ||
break | ||
while let object = enumerator.nextObject() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we revert changes to this file as #9012 migrate this suite to SwiftTesting, and may address this.
@@ -686,7 +686,7 @@ final class MiscellaneousTestCase: XCTestCase { | |||
guard case SwiftPMError.executionFailure(_, _, let stderr) = error else { | |||
return XCTFail("invalid error \(error)") | |||
} | |||
XCTAssert(stderr.contains("error: You don’t have permission"), "expected permissions error. stderr: '\(stderr)'") | |||
XCTAssert(stderr.contains("error: You don’t have permission") || stderr.contains("invalid access"), "expected permissions error. stderr: '\(stderr)'") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (possibly-blocking): I this is also update a test case. do we know if this new expectation is expected, or whether it's a regression?
@@ -721,7 +721,7 @@ final class MiscellaneousTestCase: XCTestCase { | |||
guard case SwiftPMError.executionFailure(_, _, let stderr) = error else { | |||
return XCTFail("invalid error \(error)") | |||
} | |||
XCTAssert(stderr.contains("error: You don’t have permission"), "expected permissions error. stderr: '\(stderr)'") | |||
XCTAssert(stderr.contains("error: You don’t have permission") || stderr.contains("invalid access"), "expected permissions error. stderr: '\(stderr)'") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (possibly-blocking): I this is also update a test case. do we know if this new expectation is expected, or whether it's a regression?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is unrelated to my patch, but its because this test is failing on main
. I had to fix it to get CI to pass. To verify, make sure you do a swift package update
first.
@@ -756,7 +756,7 @@ final class MiscellaneousTestCase: XCTestCase { | |||
guard case SwiftPMError.executionFailure(_, _, let stderr) = error else { | |||
return XCTFail("invalid error \(error)") | |||
} | |||
XCTAssert(stderr.contains("error: You don’t have permission"), "expected permissions error. stderr: '\(stderr)'") | |||
XCTAssert(stderr.contains("error: You don’t have permission") || stderr.contains("invalid access"), "expected permissions error. stderr: '\(stderr)'") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (possibly-blocking): I this is also update a test case. do we know if this new expectation is expected, or whether it's a regression?
@swift-ci test self hosted |
try
statements for function calls that do not throw#expect
checks for values that cannot benil