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

[gardening] Migrate from unwrapped() to XCTUnwrap() #2462

Merged

Conversation

drodriguez
Copy link
Contributor

Instead of using an extension on Optional only available in Foundation,
we should start using the recently introduced XCTUnwrap available in
XCTest to perform the same job. The XCTest API would probably be more
known in other code bases, so people will be more willing to use it and
learn it.

The commit removes all the usages of unwrapped and replaces them with
XCTUnwrap. Additionally it marks unwrapped() as deprecated, so people
receive a clear message about the disappearance with a helpful hint of
what to use instead.

@drodriguez drodriguez requested review from millenomi and spevans August 7, 2019 22:27
Copy link
Contributor

@millenomi millenomi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're using .unwrapped() in a non-test sense in GenerateTestFixtures. You'll either have to scrap this or shim it there.

@drodriguez
Copy link
Contributor Author

GenerateTestFixtures has its own implementation and I haven't touch it with this commit (ref: the file as it is with this commit https://github.com/apple/swift-corelibs-foundation/blob/d3df79dc5f2624be38dd7086a2291a51452111a9/Tools/GenerateTestFixtures/GenerateTestFixtures/Utilities.swift)

@drodriguez
Copy link
Contributor Author

All right. I understand what you mean. It can be modified.

I think it flew under my radar because CMake doesn't seem to build that target.

@drodriguez drodriguez force-pushed the migrate-unwrapped-to-xctunwrap branch 2 times, most recently from 7017fc9 to 4a70b78 Compare August 8, 2019 21:35
@drodriguez
Copy link
Contributor Author

@swift-ci please test Linux Platform

@millenomi
Copy link
Contributor

It is intentional that CMake doesn't build that target; that target is meant to be built on macOS with the shipping version of Xcode, for now.

@millenomi
Copy link
Contributor

More to the point, right now we're building that target for Mojave (to generate the macOS-10.14 test fixtures in TestFoundation/Fixtures).

@millenomi
Copy link
Contributor

I hadn't thought this through — of course we can build GTF with XCTUnwrap, since you're providing one. Whoops.

@millenomi
Copy link
Contributor

@swift-ci please test and merge

1 similar comment
@millenomi
Copy link
Contributor

@swift-ci please test and merge

@millenomi
Copy link
Contributor

I'll need to catch up with new tests.

Instead of using an extension on Optional only available in Foundation,
we should start using the recently introduced XCTUnwrap available in
XCTest to perform the same job. The XCTest API would probably be more
known in other code bases, so people will be more willing to use it and
learn it.

The commit removes all the usages of unwrapped and replaces them with
XCTUnwrap. Additionally it marks unwrapped() as deprecated, so people
receive a clear message about the disappearance with a helpful hint of
what to use instead.
@drodriguez drodriguez force-pushed the migrate-unwrapped-to-xctunwrap branch from 4a70b78 to 9b83d91 Compare August 21, 2019 23:27
@drodriguez
Copy link
Contributor Author

Removed the unwrapped() calls introduced in TestSocketPort.

@swift-ci please test

@drodriguez
Copy link
Contributor Author

@swift-ci please test

@drodriguez
Copy link
Contributor Author

@swift-ci please test Linux platform

@drodriguez drodriguez merged commit fe6ec41 into swiftlang:master Aug 23, 2019
@drodriguez drodriguez deleted the migrate-unwrapped-to-xctunwrap branch August 23, 2019 22:22
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