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,9 +50,7 @@ class StateMachineChainTests: _TestCase
5050 var invokeCount = 0
5151
5252 // add 0 => 1 => 2
53- machine. addRouteChain ( . State0 => . State1 => . State2, condition: { _ -> Bool in
54- return flag
55- } ) { ( context) -> Void in
53+ machine. addRouteChain ( . State0 => . State1 => . State2, condition: { _ in flag } ) { ( context) -> Void in
5654 invokeCount++
5755 return
5856 }
Original file line number Diff line number Diff line change @@ -103,9 +103,7 @@ class StateMachineTests: _TestCase
103103 var flag = false
104104
105105 // add 0 => 1
106- machine. addRoute ( . State0 => . State1, condition: { _ -> Bool in
107- return flag
108- } )
106+ machine. addRoute ( . State0 => . State1, condition: { _ in flag } )
109107
110108 XCTAssertFalse ( machine. hasRoute ( . State0 => . State1) )
111109
@@ -163,9 +161,7 @@ class StateMachineTests: _TestCase
163161 machine. addRoute ( . State0 => . State1)
164162
165163 // add 0 => 1 with condition + conditionalHandler
166- machine. addRoute ( . State0 => . State1, condition: { _ -> Bool in
167- return flag
168- } ) { context in
164+ machine. addRoute ( . State0 => . State1, condition: { _ in flag } ) { context in
169165 returnedTransition = context. transition
170166 }
171167
Original file line number Diff line number Diff line change @@ -18,12 +18,18 @@ class StateRouteTests: _TestCase
1818 XCTAssertEqual ( route. transition. toState, MyState . State1)
1919 XCTAssertTrue ( route. condition == nil )
2020
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 )
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)
2733
2834 let route3 = StateRoute < MyState > ( transition: . State2 => . State3, condition: { transition in false } )
2935 XCTAssertEqual ( route3. transition. fromState, MyState . State2)
You can’t perform that action at this time.
0 commit comments