Skip to content

Remove var preinitialization when testing bridging from Objective-C in TestIndexPath #1517

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
Apr 16, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions TestFoundation/TestIndexPath.swift
Original file line number Diff line number Diff line change
Expand Up @@ -636,25 +636,25 @@ class TestIndexPath: XCTestCase {
return NSIndexPath(indexes: buffer.baseAddress, length: buffer.count)
}

var ip1: IndexPath? = IndexPath()
var ip1: IndexPath?
IndexPath._forceBridgeFromObjectiveC(nsip1, result: &ip1)
XCTAssertNotNil(ip1)
XCTAssertEqual(ip1!.count, 0)

var ip2: IndexPath? = IndexPath()
var ip2: IndexPath?
IndexPath._forceBridgeFromObjectiveC(nsip2, result: &ip2)
XCTAssertNotNil(ip2)
XCTAssertEqual(ip2!.count, 1)
XCTAssertEqual(ip2![0], 1)

var ip3: IndexPath? = IndexPath()
var ip3: IndexPath?
IndexPath._forceBridgeFromObjectiveC(nsip3, result: &ip3)
XCTAssertNotNil(ip3)
XCTAssertEqual(ip3!.count, 2)
XCTAssertEqual(ip3![0], 1)
XCTAssertEqual(ip3![1], 2)

var ip4: IndexPath? = IndexPath()
var ip4: IndexPath?
IndexPath._forceBridgeFromObjectiveC(nsip4, result: &ip4)
XCTAssertNotNil(ip4)
XCTAssertEqual(ip4!.count, 3)
Expand All @@ -673,25 +673,25 @@ class TestIndexPath: XCTestCase {
return NSIndexPath(indexes: buffer.baseAddress, length: buffer.count)
}

var ip1: IndexPath? = IndexPath()
var ip1: IndexPath?
XCTAssertTrue(IndexPath._conditionallyBridgeFromObjectiveC(nsip1, result: &ip1))
XCTAssertNotNil(ip1)
XCTAssertEqual(ip1!.count, 0)

var ip2: IndexPath? = IndexPath()
var ip2: IndexPath?
XCTAssertTrue(IndexPath._conditionallyBridgeFromObjectiveC(nsip2, result: &ip2))
XCTAssertNotNil(ip2)
XCTAssertEqual(ip2!.count, 1)
XCTAssertEqual(ip2![0], 1)

var ip3: IndexPath? = IndexPath()
var ip3: IndexPath?
XCTAssertTrue(IndexPath._conditionallyBridgeFromObjectiveC(nsip3, result: &ip3))
XCTAssertNotNil(ip3)
XCTAssertEqual(ip3!.count, 2)
XCTAssertEqual(ip3![0], 1)
XCTAssertEqual(ip3![1], 2)

var ip4: IndexPath? = IndexPath()
var ip4: IndexPath?
XCTAssertTrue(IndexPath._conditionallyBridgeFromObjectiveC(nsip4, result: &ip4))
XCTAssertNotNil(ip4)
XCTAssertEqual(ip4!.count, 3)
Expand Down