File tree Expand file tree Collapse file tree 3 files changed +15
-15
lines changed Expand file tree Collapse file tree 3 files changed +15
-15
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,9 @@ class StateMachineChainTests: _TestCase
5050 var invokeCount = 0
5151
5252 // add 0 => 1 => 2
53- machine. addRouteChain ( . State0 => . State1 => . State2, condition: { _ in flag } ) { ( context) -> Void in
53+ machine. addRouteChain ( . State0 => . State1 => . State2, condition: { _ -> Bool in
54+ return flag
55+ } ) { ( context) -> Void in
5456 invokeCount++
5557 return
5658 }
Original file line number Diff line number Diff line change @@ -103,7 +103,9 @@ class StateMachineTests: _TestCase
103103 var flag = false
104104
105105 // add 0 => 1
106- machine. addRoute ( . State0 => . State1, condition: { _ in flag } )
106+ machine. addRoute ( . State0 => . State1, condition: { _ -> Bool in
107+ return flag
108+ } )
107109
108110 XCTAssertFalse ( machine. hasRoute ( . State0 => . State1) )
109111
@@ -161,7 +163,9 @@ class StateMachineTests: _TestCase
161163 machine. addRoute ( . State0 => . State1)
162164
163165 // add 0 => 1 with condition + conditionalHandler
164- machine. addRoute ( . State0 => . State1, condition: { _ in flag } ) { context in
166+ machine. addRoute ( . State0 => . State1, condition: { _ -> Bool in
167+ return flag
168+ } ) { context in
165169 returnedTransition = context. transition
166170 }
167171
Original file line number Diff line number Diff line change @@ -18,18 +18,12 @@ class StateRouteTests: _TestCase
1818 XCTAssertEqual ( route. transition. toState, MyState . State1)
1919 XCTAssertTrue ( route. condition == nil )
2020
21- //
22- // comment-out:
23- // `condition` using lazy-evaluated-@autoclosure is removed due to Swift 1.2 change
24- //
25- // From Release Note:
26- // > The @autoclosure attribute on parameters now implies the new @noescape attribute.
27- // > This intentionally limits the power of @autoclosure to control-flow and lazy evaluation use cases.
28- //
29- // let route2 = StateRoute<MyState>(transition: .State1 => .State2, condition: false)
30- // XCTAssertEqual(route2.transition.fromState, MyState.State1)
31- // XCTAssertEqual(route2.transition.toState, MyState.State2)
32- // XCTAssertTrue(route2.condition != nil)
21+ let route2 = StateRoute < MyState > ( transition: . State1 => . State2, condition: { _ -> Bool in
22+ return false
23+ } )
24+ XCTAssertEqual ( route2. transition. fromState, MyState . State1)
25+ XCTAssertEqual ( route2. transition. toState, MyState . State2)
26+ XCTAssertTrue ( route2. condition != nil )
3327
3428 let route3 = StateRoute < MyState > ( transition: . State2 => . State3, condition: { transition in false } )
3529 XCTAssertEqual ( route3. transition. fromState, MyState . State2)
You can’t perform that action at this time.
0 commit comments