Skip to content

Split out @testable tests #51

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 2 commits into from
Jun 25, 2019

Conversation

ianpartridge
Copy link
Contributor

Reduce the use of @testable. Where it is required, use it from a separate testsuite so its usage is more explicit.

@@ -27,6 +27,7 @@ import XCTest

XCTMain([
testCase(HTTPCookieTests.allTests),
testCase(SwiftHTTPInternalTests.allTests),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the new suite which requires @testable.

import NIOSSL

class TestHTTPDelegate: HTTPClientResponseDelegate {
typealias Response = Void

var state = ResponseAccumulator.State.idle
enum State {
Copy link
Contributor Author

@ianpartridge ianpartridge Jun 24, 2019

Choose a reason for hiding this comment

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

@testable was only required because we were piggy-backing on ResponseAccumulator.State. As we're not using the rest of ResponseAccumulator I think it's better to just define the state we need here.


extension SwiftHTTPInternalTests {
static var allTests: [(String, (SwiftHTTPInternalTests) -> () throws -> Void)] {
return [
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are the 5 tests which require @testable.

@testable import NIOHTTP1
@testable import NIOHTTPClient
import NIOSSL
import NIOHTTP1
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Clean up the imports while we're here. No need to use @testable on NIO modules.

@ianpartridge ianpartridge changed the title Split out @internal tests Split out @testable tests Jun 24, 2019
@weissi
Copy link
Contributor

weissi commented Jun 24, 2019

That’s a great idea, thanks @ianpartridge .

@ianpartridge
Copy link
Contributor Author

Rebased, fixed conflicts, ready for review.

@artemredkin
Copy link
Collaborator

One small question but otherwise looks good @ianpartridge, thanks!

@ianpartridge ianpartridge merged commit a076303 into swift-server:master Jun 25, 2019
@ianpartridge ianpartridge deleted the internal-tests branch June 25, 2019 08:19
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.

3 participants