-
-
Notifications
You must be signed in to change notification settings - Fork 602
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Provide basic integration with Swift Testing This is not reliable, in fact, failure reporting is flaky. * Spike utilizing my changes to Swift Testing to allow direct recording of issues * link to my branch of swift testing enabling public issues * Support the current version of Swift Testing * Fix broken tests * Fix a broken test helper * Correct a long-broken test because expectFailureMessageRegex has been a no-op for ages
- Loading branch information
Showing
21 changed files
with
448 additions
and
198 deletions.
There are no files selected for viewing
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
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,44 @@ | ||
import Foundation | ||
#if canImport(Testing) | ||
import Testing | ||
#endif | ||
|
||
public class NimbleSwiftTestingHandler: AssertionHandler { | ||
public func assert(_ assertion: Bool, message: FailureMessage, location: SourceLocation) { | ||
if !assertion { | ||
recordTestingFailure("\(message.stringValue)\n", location: location) | ||
} | ||
} | ||
} | ||
|
||
func isSwiftTestingAvailable() -> Bool { | ||
#if canImport(Testing) | ||
true | ||
#else | ||
false | ||
#endif | ||
} | ||
|
||
func isRunningSwiftTest() -> Bool { | ||
#if canImport(Testing) | ||
Test.current != nil | ||
#else | ||
false | ||
#endif | ||
} | ||
|
||
public func recordTestingFailure(_ message: String, location: SourceLocation) { | ||
#if canImport(Testing) | ||
let testingLocation = Testing.SourceLocation( | ||
fileID: location.fileID, | ||
filePath: "\(location.filePath)", | ||
line: Int(location.line), | ||
column: Int(location.column) | ||
) | ||
|
||
Testing.Issue.record( | ||
"\(message)", | ||
sourceLocation: testingLocation | ||
) | ||
#endif | ||
} |
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
Oops, something went wrong.