@@ -3,14 +3,14 @@ import XCTest
3
3
4
4
final class OutputTests : XCTestCase {
5
5
func testInitialNoValue( ) {
6
- let output = MutableOutput < String > ( )
6
+ let output = Output < String > ( )
7
7
output. bind { _ in
8
8
XCTFail ( " should not be called as Output has no value set " )
9
9
}
10
10
}
11
11
12
12
func testInitialValue( ) {
13
- let output = MutableOutput < String > ( value: " Test " )
13
+ let output = Output < String > ( value: " Test " )
14
14
var closureCalled : Bool = false
15
15
output. debug ( identifier: " 123 " ) . bind { value in
16
16
XCTAssertEqual ( " Test " , value)
@@ -22,7 +22,7 @@ final class OutputTests: XCTestCase {
22
22
func testBinderIsCalled( ) {
23
23
let testObject = BindableMock ( )
24
24
25
- let output = MutableOutput < String > ( )
25
+ let output = Output < String > ( )
26
26
output. bind ( to: testObject. binding. text)
27
27
28
28
XCTAssertNil ( testObject. text)
@@ -36,7 +36,7 @@ final class OutputTests: XCTestCase {
36
36
let testObjectOne = BindableMock ( )
37
37
let testObjectTwo = BindableMock ( )
38
38
39
- let output = MutableOutput < String > ( )
39
+ let output = Output < String > ( )
40
40
output. bind ( to: [ testObjectOne. binding. text,
41
41
testObjectTwo. binding. text] )
42
42
@@ -52,7 +52,7 @@ final class OutputTests: XCTestCase {
52
52
func testUnbind( ) {
53
53
let testObject = BindableMock ( )
54
54
55
- let output = MutableOutput < String > ( )
55
+ let output = Output < String > ( )
56
56
let subscription = output. bind ( to: testObject. binding. text)
57
57
58
58
XCTAssertNil ( testObject. text)
@@ -69,13 +69,13 @@ final class OutputTests: XCTestCase {
69
69
}
70
70
71
71
func testCombine( ) {
72
- let output1 = MutableOutput < Bool > ( )
73
- let output2 = MutableOutput < Bool > ( )
72
+ let output1 = Output < Bool > ( )
73
+ let output2 = Output < Bool > ( )
74
74
75
75
var outputValue1 : Bool ?
76
76
var outputValue2 : Bool ?
77
77
78
- MutableOutput < Bool > . combine ( output1, output2) . bind { value1, value2 in
78
+ Output < Bool > . combine ( output1, output2) . bind { value1, value2 in
79
79
outputValue1 = value1
80
80
outputValue2 = value2
81
81
}
@@ -100,15 +100,15 @@ final class OutputTests: XCTestCase {
100
100
}
101
101
102
102
func testCombineArray( ) {
103
- let output1 = MutableOutput < Bool > ( )
104
- let output2 = MutableOutput < Bool > ( )
105
- let output3 = MutableOutput < Bool > ( )
103
+ let output1 = Output < Bool > ( )
104
+ let output2 = Output < Bool > ( )
105
+ let output3 = Output < Bool > ( )
106
106
107
107
var outputValue1 : Bool ?
108
108
var outputValue2 : Bool ?
109
109
var outputValue3 : Bool ?
110
110
111
- MutableOutput < Bool > . combine ( outputs: [ output1, output2, output3] ) . bind { valuesArray in
111
+ Output < Bool > . combine ( outputs: [ output1, output2, output3] ) . bind { valuesArray in
112
112
outputValue1 = valuesArray [ 0 ]
113
113
outputValue2 = valuesArray [ 1 ]
114
114
outputValue3 = valuesArray [ 2 ]
@@ -144,13 +144,13 @@ final class OutputTests: XCTestCase {
144
144
}
145
145
146
146
func testCombineTwoTypes( ) {
147
- let output1 = MutableOutput < Bool > ( )
148
- let output2 = MutableOutput < String > ( )
147
+ let output1 = Output < Bool > ( )
148
+ let output2 = Output < String > ( )
149
149
150
150
var outputValue1 : Bool ?
151
151
var outputValue2 : String ?
152
152
153
- MutableOutput < Bool >
153
+ Output < Bool >
154
154
. combine ( output1, output2)
155
155
. bind { value1, value2 in
156
156
outputValue1 = value1
@@ -183,9 +183,9 @@ final class OutputTests: XCTestCase {
183
183
case two
184
184
}
185
185
186
- let value = MutableOutput < TestEnum > ( )
186
+ let value = Output < TestEnum > ( )
187
187
188
- let mappedValue : MutableOutput < String > =
188
+ let mappedValue : Output < String > =
189
189
value
190
190
. map { type in
191
191
switch type {
@@ -195,7 +195,6 @@ final class OutputTests: XCTestCase {
195
195
return " two "
196
196
}
197
197
}
198
- . asMutable ( )
199
198
200
199
value. update ( withValue: . one)
201
200
XCTAssertEqual ( mappedValue. latest, " one " )
@@ -214,9 +213,9 @@ final class OutputTests: XCTestCase {
214
213
case two
215
214
}
216
215
217
- let value = MutableOutput < TestEnum > ( )
216
+ let value = Output < TestEnum > ( )
218
217
219
- let mappedValue : MutableOutput < String > =
218
+ let mappedValue : Output < String > =
220
219
value
221
220
. flatMap { type in
222
221
switch type {
@@ -226,7 +225,6 @@ final class OutputTests: XCTestCase {
226
225
return Output ( value: " two " )
227
226
}
228
227
}
229
- . asMutable ( )
230
228
231
229
value. update ( withValue: . one)
232
230
XCTAssertEqual ( mappedValue. latest, " one " )
@@ -239,7 +237,7 @@ final class OutputTests: XCTestCase {
239
237
}
240
238
241
239
func testFilter( ) {
242
- let value = MutableOutput < String > ( )
240
+ let value = Output < String > ( )
243
241
244
242
let filteredValue = value
245
243
. filter { string in
@@ -257,8 +255,8 @@ final class OutputTests: XCTestCase {
257
255
}
258
256
259
257
func testMerge( ) {
260
- let output1 = MutableOutput < Int > ( )
261
- let output2 = MutableOutput < Int > ( )
258
+ let output1 = Output < Int > ( )
259
+ let output2 = Output < Int > ( )
262
260
263
261
let merge = Output . merge ( output1, output2)
264
262
@@ -282,7 +280,7 @@ final class OutputTests: XCTestCase {
282
280
var currentString : String = " "
283
281
}
284
282
285
- let initial = MutableOutput < Int > ( )
283
+ let initial = Output < Int > ( )
286
284
287
285
let reduced = initial
288
286
. reduce ( initial: TestObject ( ) ) { current, number -> TestObject in
@@ -300,7 +298,7 @@ final class OutputTests: XCTestCase {
300
298
}
301
299
302
300
func testReduceValueType( ) {
303
- let initial = MutableOutput < Int > ( )
301
+ let initial = Output < Int > ( )
304
302
305
303
let reduced = initial. reduce ( initial: 0 , nextPartialResult: + )
306
304
@@ -312,16 +310,16 @@ final class OutputTests: XCTestCase {
312
310
}
313
311
314
312
func testInitialValueFunctionChain( ) {
315
- let initial = MutableOutput < Int > ( ) . initial ( 10 )
313
+ let initial = Output < Int > ( ) . initial ( 10 )
316
314
XCTAssertEqual ( initial. latest, 10 )
317
315
318
- let alreadyPopulated = MutableOutput < Int > ( value: 5 ) . initial ( 10 )
316
+ let alreadyPopulated = Output < Int > ( value: 5 ) . initial ( 10 )
319
317
XCTAssertEqual ( alreadyPopulated. latest, 5 )
320
318
321
- let left = MutableOutput ( value: 3 )
322
- let right = MutableOutput < Int > ( )
319
+ let left = Output ( value: 3 )
320
+ let right = Output < Int > ( )
323
321
324
- let combined = MutableOutput
322
+ let combined = Output
325
323
. combine ( left, right)
326
324
. map ( + )
327
325
. initial ( 20 )
@@ -337,7 +335,7 @@ final class OutputTests: XCTestCase {
337
335
338
336
func testDebug( ) {
339
337
let printer = PrinterMock ( )
340
- let output1 = MutableOutput < Bool > ( printer: printer)
338
+ let output1 = Output < Bool > ( printer: printer)
341
339
342
340
XCTAssertTrue ( printer. printValues. isEmpty)
343
341
@@ -347,16 +345,16 @@ final class OutputTests: XCTestCase {
347
345
348
346
XCTAssertEqual ( printer. printValues. count, 3 )
349
347
XCTAssertEqual ( printer. printValues [ 0 ] , " --- " )
350
- XCTAssertEqual ( printer. printValues [ 1 ] , " Binding 123 (MutableOutput <Bool>) to (Function) " )
348
+ XCTAssertEqual ( printer. printValues [ 1 ] , " Binding 123 (Output <Bool>) to (Function) " )
351
349
XCTAssertEqual ( printer. printValues [ 2 ] , " To bindings: [Bind.Subscription: (Function)] " )
352
350
353
351
output1. update ( withValue: false )
354
352
355
353
XCTAssertEqual ( printer. printValues. count, 8 )
356
354
XCTAssertEqual ( printer. printValues [ 3 ] , " --- " )
357
- XCTAssertEqual ( printer. printValues [ 4 ] , " Will update value for 123 (MutableOutput <Bool>) to false " )
355
+ XCTAssertEqual ( printer. printValues [ 4 ] , " Will update value for 123 (Output <Bool>) to false " )
358
356
XCTAssertEqual ( printer. printValues [ 5 ] , " To bindings: [Bind.Subscription: (Function)] " )
359
- XCTAssertEqual ( printer. printValues [ 6 ] , " Did update value for 123 (MutableOutput <Bool>) to false " )
357
+ XCTAssertEqual ( printer. printValues [ 6 ] , " Did update value for 123 (Output <Bool>) to false " )
360
358
XCTAssertEqual ( printer. printValues [ 7 ] , " To bindings: [Bind.Subscription: (Function)] " )
361
359
}
362
360
}
0 commit comments