Skip to content
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

[SR-5262] XCTest should have a way to validate assertions #370

phausler opened this issue Jun 19, 2017 · 1 comment

[SR-5262] XCTest should have a way to validate assertions #370

phausler opened this issue Jun 19, 2017 · 1 comment


Copy link

@phausler phausler commented Jun 19, 2017

Previous ID SR-5262
Radar None
Original Reporter @phausler
Type New Feature
Additional Detail from JIRA
Votes 0
Component/s XCTest
Labels New Feature
Assignee None
Priority Medium

md5: 45492463837a5115b54a5e4cdffbc273

Issue Description:

Often times when testing code it is helpful to validate assertion cases that have preconditions or fatalErrors. A method that would aide in this endeavor would be something along the lines of XCTAssertIsFatal where a block of code is passed in that is expected to trigger a fatalError.

Normally this would mean that the code would crash. However if a signal handler for SIGILL is installed we can validate if an assertion is tripped.

See for a rough draft at handling fatal assertions (note this only works in a non attached debugger mode and has only been written for Darwin, however a linux port should be trivial)

Copy link

@belkadan belkadan commented Jun 20, 2017

This has been discussed before. StdlibUnittest takes a different approach: fork off a child process, and check its output. That's a little less dangerous—recovering from a fatalError means leaking memory at the very least.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

2 participants