Skip to content

XCTUnwrap API #279

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

Merged
merged 1 commit into from
Jul 22, 2019
Merged

XCTUnwrap API #279

merged 1 commit into from
Jul 22, 2019

Conversation

stmontgomery
Copy link
Contributor

Adds a new API XCTUnwrap which asserts that an expression is non-nil,
and returns the unwrapped value. This matches a new API added in Apple's
ObjC XCTest framework in Xcode 11 Beta 1 (see release notes.)

  • Adds an internal user info key XCTestErrorUserInfoKeyShouldIgnore which
    will cause errors not to be recorded as failures at the end of a test. This
    will make sure that errors from XCTUnwrap are not recorded twice (the assertion
    failure and the thrown error). This can then be further extended to any errors
    that should be ignored by the framework.
  • Adds XCTUnwrap, which either returns the unwrapped value or records a failure
    and raises an error. The error includes XCTestErrorUserInfoKeyShouldIgnore.
  • Adds unit tests for XCTUnwrap.

I (@stmontgomery) am posting these changes on behalf of my colleague Andrea Fernandez Buitrago, and will be serving as the primary reviewer.

rdar://problem/48810220

@stmontgomery stmontgomery self-assigned this Jul 1, 2019
@stmontgomery
Copy link
Contributor Author

@swift-ci Please test

Adds a new API `XCTUnwrap` which asserts that an expression is non-nil,
and returns the unwrapped value. This matches a new API added in Apple's
ObjC XCTest framework in Xcode 11 Beta 1 (see
[release notes](https://developer.apple.com/documentation/xcode_release_notes/xcode_11_beta_2_release_notes#3318281).)

- Adds an internal user info key `XCTestErrorUserInfoKeyShouldIgnore` which
  will cause errors not to be recorded as failures at the end of a test. This
  will make sure that errors from `XCTUnwrap` are not recorded twice (the assertion
  failure _and_ the thrown error). This can then be further extended to any errors
  that should be ignored by the framework.
- Adds `XCTUnwrap`, which either returns the unwrapped value or records a failure
  and raises an error. The error includes `XCTestErrorUserInfoKeyShouldIgnore`.
- Adds unit tests for `XCTUnwrap`.

rdar://problem/48810220
@stmontgomery
Copy link
Contributor Author

@swift-ci Please test

1 similar comment
@stmontgomery
Copy link
Contributor Author

@swift-ci Please test

@stmontgomery stmontgomery merged commit 3675a01 into swiftlang:master Jul 22, 2019
@stmontgomery stmontgomery deleted the XCTUnwrap branch July 22, 2019 04:58
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.

2 participants