Last active
March 31, 2020 08:25
-
-
Save paulz/e2068a3a635c1adf2050e2eb5c9b0a06 to your computer and use it in GitHub Desktop.
Expect Exception without breaking in debugger
This file contains hidden or 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
| objc_exception_throw: | |
| console command: | |
| script lldb.process.Continue() if (lldb.frame.GetThread().GetName() == "skip-objc_exception_throw") else None |
This file contains hidden or 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
| it("should raise URL is nil") { | |
| let selector = "-[NSFileManager enumeratorAtURL:includingPropertiesForKeys:options:errorHandler:]" | |
| let reason = "*** \(selector): URL is nil" | |
| expectException(named: "NSInvalidArgumentException", reason: reason) { | |
| subject.importFromURL() | |
| } | |
| } |
This file contains hidden or 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
| import Nimble | |
| func expectException(timeout: TimeInterval = AsyncDefaults.Timeout, | |
| named: String? = nil, | |
| reason: String? = nil, | |
| file: FileString = #file, | |
| line: UInt = #line, | |
| block: @escaping () -> Void) { | |
| waitUntil(timeout: timeout, file: file, line: line) { done in | |
| let thread = Thread { | |
| expect(file, line: line) { | |
| block() | |
| }.to(raiseException(named: named, reason: reason)) | |
| done() | |
| } | |
| thread.name = "skip-objc_exception_throw" | |
| thread.start() | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment