Skip to content

Commit 5c0c3d6

Browse files
carlosypuntokzaher
authored andcommitted
update tests to swift 4
1 parent dee2136 commit 5c0c3d6

13 files changed

+41
-31
lines changed

RxTest/ColdObservable.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ final class ColdObservable<Element>
2727
let i = self.subscriptions.count - 1
2828

2929
for recordedEvent in recordedEvents {
30-
_ = testScheduler.scheduleRelativeVirtual((), dueTime: recordedEvent.time, action: { (_) in
30+
_ = testScheduler.scheduleRelativeVirtual((), dueTime: recordedEvent.time, action: { _ in
3131
observer.on(recordedEvent.value)
3232
return Disposables.create()
3333
})

Tests/RxCocoaTests/NSButton+RxTests.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ extension NSButtonTests {
2828

2929
func testButton_state_observer_on() {
3030
let button = NSButton(frame: CGRect(x: 0, y: 0, width: 1, height: 1))
31-
_ = Observable.just(NSOnState).bind(to: button.rx.state)
31+
_ = Observable.just(NSControl.StateValue.onState.rawValue).bind(to: button.rx.state)
3232

33-
XCTAssertEqual(button.state, NSOnState)
33+
XCTAssertEqual(button.state, NSControl.StateValue.onState)
3434
}
3535

3636
func testButton_state_observer_off() {
3737
let button = NSButton(frame: CGRect(x: 0, y: 0, width: 1, height: 1))
38-
_ = Observable.just(NSOffState).bind(to: button.rx.state)
38+
_ = Observable.just(NSControl.StateValue.onState.rawValue).bind(to: button.rx.state)
3939

40-
XCTAssertEqual(button.state, NSOffState)
40+
XCTAssertEqual(button.state, NSControl.StateValue.onState)
4141
}
4242
}

Tests/RxCocoaTests/NSLayoutConstraint+RxTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import RxSwift
1010
import RxCocoa
1111
import XCTest
1212
#if os(macOS)
13-
import Cocoa
13+
import AppKit
1414
typealias View = NSView
1515
#else
1616
import UIKit

Tests/RxCocoaTests/NSTextField+RxTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ extension NSTextFieldTests {
4343
XCTAssertFalse(delegate.didChange)
4444

4545
let notification = Notification(
46-
name: .NSControlTextDidChange,
46+
name: NSControl.textDidChangeNotification,
4747
object: textField,
4848
userInfo: ["NSFieldEditor" : NSText()])
4949
(textField.delegate as! NSObject).controlTextDidChange(notification)

Tests/RxCocoaTests/UINavigationController+RxTests.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ extension UINavigationControllerTests {
3232
XCTAssertNotEqual(animated, presentedAnimated)
3333

3434
_ = navigationController.rx.willShow
35-
.subscribe(onNext: { (viewController, animated) in
35+
.subscribe(onNext: { showEvent in
36+
let (viewController, animated) = showEvent
3637
presentedViewController = viewController
3738
presentedAnimated = animated
3839
})
@@ -69,7 +70,8 @@ extension UINavigationControllerTests {
6970
})
7071

7172
_ = navigationController.rx.didShow
72-
.subscribe(onNext: { (viewController, animated) in
73+
.subscribe(onNext: { showEvent in
74+
let (viewController, animated) = showEvent
7375
presentedViewController = viewController
7476
presentedAnimated = animated
7577
})

Tests/RxCocoaTests/UIScrollView+RxTests.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ extension UIScrollViewTests {
4646
let scrollView = UIScrollView()
4747
var didScroll = false
4848

49-
_ = scrollView.rx.didScroll.subscribe(onNext: {
49+
_ = scrollView.rx.didScroll.subscribe(onNext: { _ in
5050
didScroll = true
5151
}, onCompleted: {
5252
completed = true
@@ -70,7 +70,7 @@ extension UIScrollViewTests {
7070
let scrollView = UIScrollView()
7171
var didEndDecelerating = false
7272

73-
_ = scrollView.rx.didEndDecelerating.subscribe(onNext: {
73+
_ = scrollView.rx.didEndDecelerating.subscribe(onNext: { _ in
7474
didEndDecelerating = true
7575
}, onCompleted: {
7676
completed = true
@@ -141,7 +141,7 @@ extension UIScrollViewTests {
141141
let scrollView = UIScrollView()
142142
var didZoom = false
143143

144-
let subscription = scrollView.rx.didZoom.subscribe(onNext: {
144+
let subscription = scrollView.rx.didZoom.subscribe(onNext: { _ in
145145
didZoom = true
146146
})
147147

@@ -157,7 +157,7 @@ extension UIScrollViewTests {
157157
let scrollView = UIScrollView()
158158
var didScrollToTop = false
159159

160-
let subscription = scrollView.rx.didScrollToTop.subscribe(onNext: {
160+
let subscription = scrollView.rx.didScrollToTop.subscribe(onNext: { _ in
161161
didScrollToTop = true
162162
})
163163

@@ -176,7 +176,7 @@ extension UIScrollViewTests {
176176
let scrollView = UIScrollView()
177177
var didEndScrollingAnimation = false
178178

179-
_ = scrollView.rx.didEndScrollingAnimation.subscribe(onNext: {
179+
_ = scrollView.rx.didEndScrollingAnimation.subscribe(onNext: { _ in
180180
didEndScrollingAnimation = true
181181
}, onCompleted: {
182182
completed = true

Tests/RxCocoaTests/UISearchController+RxTests.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ final class UISearchController_RxTests: RxTest {
2323
let searchController = UISearchController()
2424

2525
_ = searchController.rx.didDismiss
26-
.subscribe(onNext: {
26+
.subscribe(onNext: { _ in
2727
didDismissed = true
2828
}, onCompleted: {
2929
completed = true
@@ -43,7 +43,7 @@ final class UISearchController_RxTests: RxTest {
4343
let searchController = UISearchController()
4444

4545
_ = searchController.rx.didPresent
46-
.subscribe(onNext: {
46+
.subscribe(onNext: { _ in
4747
didPresent = true
4848
}, onCompleted: {
4949
completed = true
@@ -63,7 +63,7 @@ final class UISearchController_RxTests: RxTest {
6363
let searchController = UISearchController()
6464

6565
_ = searchController.rx.present
66-
.subscribe(onNext: {
66+
.subscribe(onNext: { _ in
6767
presented = true
6868
}, onCompleted: {
6969
completed = true
@@ -83,7 +83,7 @@ final class UISearchController_RxTests: RxTest {
8383
let searchController = UISearchController()
8484

8585
_ = searchController.rx.willDismiss
86-
.subscribe(onNext: {
86+
.subscribe(onNext: { _ in
8787
willDismiss = true
8888
}, onCompleted: {
8989
completed = true
@@ -103,7 +103,7 @@ final class UISearchController_RxTests: RxTest {
103103
let searchController = UISearchController()
104104

105105
_ = searchController.rx.willPresent
106-
.subscribe(onNext: {
106+
.subscribe(onNext: { _ in
107107
willPresent = true
108108
}, onCompleted: {
109109
completed = true

Tests/RxCocoaTests/UITabBar+RxTests.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ extension UITabBarTests {
6262
var changed: Bool!
6363

6464
_ = subject.rx.willEndCustomizing
65-
.subscribe(onNext: { (i, c) in
65+
.subscribe(onNext: { value in
66+
let (i, c) = value
6667
returnedItems = i
6768
changed = c
6869
})
@@ -80,7 +81,8 @@ extension UITabBarTests {
8081
var changed: Bool!
8182

8283
_ = subject.rx.didEndCustomizing
83-
.subscribe(onNext: { (i, c) in
84+
.subscribe(onNext: { value in
85+
let (i, c) = value
8486
returnedItems = i
8587
changed = c
8688
})

Tests/RxCocoaTests/UITabBarController+RxTests.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ extension UITabBarControllerTests {
5151
XCTAssertNotEqual(changed, true)
5252

5353
_ = subject.rx.willEndCustomizing
54-
.subscribe(onNext: { (vc, c) in
54+
.subscribe(onNext: { value in
55+
let (vc, c) = value
5556
returnedViewControllers = vc
5657
changed = c
5758
})
@@ -73,7 +74,8 @@ extension UITabBarControllerTests {
7374
XCTAssertNotEqual(changed, true)
7475

7576
_ = subject.rx.didEndCustomizing
76-
.subscribe(onNext: { (vc, c) in
77+
.subscribe(onNext: { value in
78+
let (vc, c) = value
7779
returnedViewControllers = vc
7880
changed = c
7981
})

Tests/RxCocoaTests/UITableView+RxTests.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ final class UITableViewTests : RxTest {
143143
var resultCell: UITableViewCell? = nil
144144

145145
let subscription = tableView.rx.willDisplayCell
146-
.subscribe(onNext: { (cell, indexPath) in
146+
.subscribe(onNext: { cellInfo in
147+
let (cell, indexPath) = cellInfo
147148
resultIndexPath = indexPath
148149
resultCell = cell
149150
})
@@ -164,7 +165,8 @@ final class UITableViewTests : RxTest {
164165
var resultCell: UITableViewCell? = nil
165166

166167
let subscription = tableView.rx.didEndDisplayingCell
167-
.subscribe(onNext: { (cell, indexPath) in
168+
.subscribe(onNext: { cellInfo in
169+
let (cell, indexPath) = cellInfo
168170
resultIndexPath = indexPath
169171
resultCell = cell
170172
})
@@ -196,7 +198,8 @@ final class UITableViewTests : RxTest {
196198
var resultIndexPath2: IndexPath? = nil
197199

198200
let subscription = tableView.rx.itemMoved
199-
.subscribe(onNext: { (indexPath, indexPath2) in
201+
.subscribe(onNext: { indexPaths in
202+
let (indexPath, indexPath2) = indexPaths
200203
resultIndexPath = indexPath
201204
resultIndexPath2 = indexPath2
202205
})

0 commit comments

Comments
 (0)