From cad12fffcb9249018e0793ac35395e11edca7d3f Mon Sep 17 00:00:00 2001 From: Yasuhiro Inami Date: Sun, 16 Apr 2017 22:51:37 +0900 Subject: [PATCH] Rename `NextMapping` to `EffectMapping` --- Demo/ViewController.swift | 2 +- README.md | 2 +- RxAutomaton.xcodeproj/project.pbxproj | 16 ++++---- Sources/Automaton.swift | 39 ++++++++++--------- Sources/Mapping+Helper.swift | 10 ++--- Tests/LinuxMain.swift | 4 +- ...ec.swift => EffectMappingLatestSpec.swift} | 12 +++--- ...pingSpec.swift => EffectMappingSpec.swift} | 20 +++++----- .../StateFuncMappingSpec.swift | 4 +- Tests/RxAutomatonTests/TerminatingSpec.swift | 36 ++++++++--------- 10 files changed, 73 insertions(+), 72 deletions(-) rename Tests/RxAutomatonTests/{StrategyLatestSpec.swift => EffectMappingLatestSpec.swift} (89%) rename Tests/RxAutomatonTests/{NextMappingSpec.swift => EffectMappingSpec.swift} (94%) diff --git a/Demo/ViewController.swift b/Demo/ViewController.swift index f1a2dea..3f1148a 100644 --- a/Demo/ViewController.swift +++ b/Demo/ViewController.swift @@ -59,7 +59,7 @@ class AutomatonViewController: UIViewController let canForceLogout: (State) -> Bool = [.loggingIn, .loggedIn].contains /// Transition mapping. - let mappings: [Automaton.NextMapping] = [ + let mappings: [Automaton.EffectMapping] = [ /* Input | fromState => toState | Effect */ /* ----------------------------------------------------------*/ diff --git a/README.md b/README.md index 21c386a..a79d29f 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ let forcelogoutOKProducer = /* do something more special, ..., and send `Input.l let canForceLogout: State -> Bool = [.loggingIn, .loggedIn].contains // 2. Setup state-transition mappings. -let mappings: [Automaton.NextMapping] = [ +let mappings: [Automaton.EffectMapping] = [ /* Input | fromState => toState | Effect */ /* ----------------------------------------------------------*/ diff --git a/RxAutomaton.xcodeproj/project.pbxproj b/RxAutomaton.xcodeproj/project.pbxproj index 09d2d9d..c8a3de4 100644 --- a/RxAutomaton.xcodeproj/project.pbxproj +++ b/RxAutomaton.xcodeproj/project.pbxproj @@ -20,8 +20,8 @@ 4822CC421D6197A800783A77 /* ToRACHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4822CC411D6197A800783A77 /* ToRACHelper.swift */; }; 487BDE631D619D3200C86902 /* AnyMappingSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4822CC2F1D6194FD00783A77 /* AnyMappingSpec.swift */; }; 487BDE641D619D4500C86902 /* TerminatingSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4822CC331D6194FD00783A77 /* TerminatingSpec.swift */; }; - 487BDE6B1D61AFF300C86902 /* StrategyLatestSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4822CC321D6194FD00783A77 /* StrategyLatestSpec.swift */; }; - 487BDE6C1D61B03700C86902 /* NextMappingSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4822CC311D6194FD00783A77 /* NextMappingSpec.swift */; }; + 487BDE6B1D61AFF300C86902 /* EffectMappingLatestSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4822CC321D6194FD00783A77 /* EffectMappingLatestSpec.swift */; }; + 487BDE6C1D61B03700C86902 /* EffectMappingSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4822CC311D6194FD00783A77 /* EffectMappingSpec.swift */; }; 488738E01D61689000BF70F4 /* RxAutomaton.h in Headers */ = {isa = PBXBuildFile; fileRef = 488738DF1D61689000BF70F4 /* RxAutomaton.h */; settings = {ATTRIBUTES = (Public, ); }; }; 488738E71D61689100BF70F4 /* RxAutomaton.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 488738DC1D61689000BF70F4 /* RxAutomaton.framework */; }; 488738F71D6168A600BF70F4 /* Automaton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 488738F61D6168A600BF70F4 /* Automaton.swift */; }; @@ -83,8 +83,8 @@ 1FCAB4E51DC794A900EA6EBF /* Quick.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Quick.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 4822CC2F1D6194FD00783A77 /* AnyMappingSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnyMappingSpec.swift; sourceTree = ""; }; 4822CC301D6194FD00783A77 /* MappingSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MappingSpec.swift; sourceTree = ""; }; - 4822CC311D6194FD00783A77 /* NextMappingSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NextMappingSpec.swift; sourceTree = ""; }; - 4822CC321D6194FD00783A77 /* StrategyLatestSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StrategyLatestSpec.swift; sourceTree = ""; }; + 4822CC311D6194FD00783A77 /* EffectMappingSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EffectMappingSpec.swift; sourceTree = ""; }; + 4822CC321D6194FD00783A77 /* EffectMappingLatestSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EffectMappingLatestSpec.swift; sourceTree = ""; }; 4822CC331D6194FD00783A77 /* TerminatingSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TerminatingSpec.swift; sourceTree = ""; }; 4822CC391D61961300783A77 /* RxSwift.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = RxSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 4822CC3F1D61969C00783A77 /* Fixtures.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Fixtures.swift; sourceTree = ""; }; @@ -212,10 +212,10 @@ children = ( 4822CC3E1D61969C00783A77 /* Fixtures */, 4822CC301D6194FD00783A77 /* MappingSpec.swift */, - 4822CC311D6194FD00783A77 /* NextMappingSpec.swift */, + 4822CC311D6194FD00783A77 /* EffectMappingSpec.swift */, 4822CC2F1D6194FD00783A77 /* AnyMappingSpec.swift */, 1FA0AC451DE8AC2B007F01E0 /* StateFuncMappingSpec.swift */, - 4822CC321D6194FD00783A77 /* StrategyLatestSpec.swift */, + 4822CC321D6194FD00783A77 /* EffectMappingLatestSpec.swift */, 4822CC331D6194FD00783A77 /* TerminatingSpec.swift */, 488738ED1D61689100BF70F4 /* Info.plist */, ); @@ -454,9 +454,9 @@ 1FA0AC461DE8AC2B007F01E0 /* StateFuncMappingSpec.swift in Sources */, 4822CC401D61969C00783A77 /* Fixtures.swift in Sources */, 487BDE631D619D3200C86902 /* AnyMappingSpec.swift in Sources */, - 487BDE6C1D61B03700C86902 /* NextMappingSpec.swift in Sources */, + 487BDE6C1D61B03700C86902 /* EffectMappingSpec.swift in Sources */, 487BDE641D619D4500C86902 /* TerminatingSpec.swift in Sources */, - 487BDE6B1D61AFF300C86902 /* StrategyLatestSpec.swift in Sources */, + 487BDE6B1D61AFF300C86902 /* EffectMappingLatestSpec.swift in Sources */, 4822CC421D6197A800783A77 /* ToRACHelper.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/Sources/Automaton.swift b/Sources/Automaton.swift index 9a019af..d0d0d44 100644 --- a/Sources/Automaton.swift +++ b/Sources/Automaton.swift @@ -22,16 +22,17 @@ public final class Automaton /// Basic state-transition function type. public typealias Mapping = (State, Input) -> State? - /// Transducer (input & output) mapping with `Observable` (next-producer) as output, - /// which **wraps additional effects and emit next input values** - /// for automatic & continuous state-transitions. - public typealias NextMapping = (State, Input) -> (State, Observable)? + /// Transducer (input & output) mapping with + /// `Observable` (additional effect) as output, + /// which may emit next input values for continuous state-transitions. + public typealias EffectMapping = (State, Input) -> (State, Observable)? /// `Reply` signal that notifies either `.success` or `.failure` of state-transition on every input. public let replies: Observable> /// Current state. - public let state: Variable // TODO: AnyProperty + /// - Todo: Use RxProperty https://github.com/inamiy/RxProperty + public let state: Variable private let _replyObserver: AnyObserver> @@ -43,23 +44,23 @@ public final class Automaton /// - Parameters: /// - state: Initial state. /// - input: `Observable` that automaton receives. - /// - mapping: Simple `Mapping` that designates next state only (no next-producer). + /// - mapping: Simple `Mapping` that designates next state only (no additional effect). /// public convenience init(state initialState: State, input inputSignal: Observable, mapping: @escaping Mapping) { - self.init(state: initialState, input: inputSignal, mapping: _compose(_toNextMapping, mapping)) + self.init(state: initialState, input: inputSignal, mapping: _compose(_toEffectMapping, mapping)) } /// - /// Initializer using `NextMapping`. + /// Initializer using `EffectMapping`. /// /// - Parameters: /// - state: Initial state. /// - input: `Observable` that automaton receives. - /// - mapping: `NextMapping` that designates next state and also generates next-producer. - /// - strategy: `FlattenStrategy` that flattens next-producer generated by `NextMapping`. + /// - mapping: `EffectMapping` that designates next state and also generates additional effect. + /// - strategy: `FlattenStrategy` that flattens additional effect generated by `EffectMapping`. /// - public init(state initialState: State, input inputSignal: Observable, mapping: @escaping NextMapping, strategy: FlattenStrategy = .merge) + public init(state initialState: State, input inputSignal: Observable, mapping: @escaping EffectMapping, strategy: FlattenStrategy = .merge) { let stateProperty = Variable(initialState) self.state = stateProperty // TODO: AnyProperty(stateProperty) @@ -68,7 +69,7 @@ public final class Automaton (self.replies, self._replyObserver) = (p.asObservable(), AnyObserver(eventHandler: p.asObserver().on)) /// Recursive input-producer that sends inputs from `inputSignal` - /// and also next-producers generated by `NextMapping`. + /// and also additional effects generated by `EffectMapping`. func recurInputProducer(_ inputProducer: Observable, strategy: FlattenStrategy) -> Observable { return Observable.create { observer in @@ -80,17 +81,17 @@ public final class Automaton .shareReplay(1) let successSignal = mappingSignal - .filterMap { input, fromState, nextProducer in - return nextProducer.map { (input, fromState, $0) } + .filterMap { input, fromState, effect in + return effect.map { (input, fromState, $0) } } - .flatMap(strategy) { input, fromState, nextProducer -> Observable in - return recurInputProducer(nextProducer, strategy: strategy) + .flatMap(strategy) { input, fromState, effect -> Observable in + return recurInputProducer(effect, strategy: strategy) .startWith(input) } let failureSignal = mappingSignal - .filterMap { input, fromState, nextProducer -> Input? in - return nextProducer == nil ? input : nil + .filterMap { input, fromState, effect -> Input? in + return effect == nil ? input : nil } let mergedProducer = Observable.of(failureSignal, successSignal).merge() @@ -141,7 +142,7 @@ private func _compose(_ g: @escaping (B) -> C, _ f: @escaping (A) -> B) return { x in g(f(x)) } } -private func _toNextMapping(toState: State?) -> (State, Observable)? +private func _toEffectMapping(toState: State?) -> (State, Observable)? { if let toState = toState { return (toState, .empty()) diff --git a/Sources/Mapping+Helper.swift b/Sources/Mapping+Helper.swift index 745687c..53277ca 100644 --- a/Sources/Mapping+Helper.swift +++ b/Sources/Mapping+Helper.swift @@ -73,9 +73,9 @@ public func | (input: Input, transition: @escaping (Sta return { $0 == input } | transition } -// MARK: `|` (Automaton.NextMapping constructor) +// MARK: `|` (Automaton.EffectMapping constructor) -public func | (mapping: @escaping Automaton.Mapping, nextInputProducer: Observable) -> Automaton.NextMapping +public func | (mapping: @escaping Automaton.Mapping, nextInputProducer: Observable) -> Automaton.EffectMapping { return { fromState, input in if let toState = mapping(fromState, input) { @@ -111,9 +111,9 @@ public func reduce(_ mappings: Mappings) -> Au } } -/// Folds multiple `Automaton.NextMapping`s into one (preceding mapping has higher priority). -public func reduce(_ mappings: Mappings) -> Automaton.NextMapping - where Mappings.Iterator.Element == Automaton.NextMapping +/// Folds multiple `Automaton.EffectMapping`s into one (preceding mapping has higher priority). +public func reduce(_ mappings: Mappings) -> Automaton.EffectMapping + where Mappings.Iterator.Element == Automaton.EffectMapping { return { fromState, input in for mapping in mappings { diff --git a/Tests/LinuxMain.swift b/Tests/LinuxMain.swift index 9a8352d..e1d8d06 100644 --- a/Tests/LinuxMain.swift +++ b/Tests/LinuxMain.swift @@ -5,9 +5,9 @@ import Quick Quick.QCKMain([ MappingSpec.self, - NextMappingSpec.self, + EffectMappingSpec.self, AnyMappingSpec.self, StateFuncMappingSpec.self, - NextMappingLatestSpec.self, + EffectMappingLatestSpec.self, TerminatingSpec.self ]) diff --git a/Tests/RxAutomatonTests/StrategyLatestSpec.swift b/Tests/RxAutomatonTests/EffectMappingLatestSpec.swift similarity index 89% rename from Tests/RxAutomatonTests/StrategyLatestSpec.swift rename to Tests/RxAutomatonTests/EffectMappingLatestSpec.swift index e43ec1c..f8d5be2 100644 --- a/Tests/RxAutomatonTests/StrategyLatestSpec.swift +++ b/Tests/RxAutomatonTests/EffectMappingLatestSpec.swift @@ -11,19 +11,19 @@ import RxAutomaton import Quick import Nimble -/// NextMapping tests with `strategy = .Latest`. -class NextMappingLatestSpec: QuickSpec +/// EffectMapping tests with `strategy = .latest`. +class EffectMappingLatestSpec: QuickSpec { override func spec() { typealias Automaton = RxAutomaton.Automaton - typealias NextMapping = Automaton.NextMapping + typealias EffectMapping = Automaton.EffectMapping let (signal, observer) = Observable.pipe() var automaton: Automaton? var lastReply: Reply? - describe("strategy = `.Latest`") { + describe("strategy = `.latest`") { var testScheduler: TestScheduler! @@ -40,7 +40,7 @@ class NextMappingLatestSpec: QuickSpec Observable.just(AuthInput.logoutOK) .delay(1, onScheduler: testScheduler) - let mappings: [Automaton.NextMapping] = [ + let mappings: [Automaton.EffectMapping] = [ .login | .loggedOut => .loggingIn | loginOKProducer, .loginOK | .loggingIn => .loggedIn | .empty(), .logout | .loggedIn => .loggingOut | logoutOKProducer, @@ -57,7 +57,7 @@ class NextMappingLatestSpec: QuickSpec lastReply = nil } - it("`strategy = .Latest` should not interrupt inner next-producers when transition fails") { + it("`strategy = .latest` should not interrupt inner effects when transition fails") { expect(automaton?.state.value) == .loggedOut expect(lastReply).to(beNil()) diff --git a/Tests/RxAutomatonTests/NextMappingSpec.swift b/Tests/RxAutomatonTests/EffectMappingSpec.swift similarity index 94% rename from Tests/RxAutomatonTests/NextMappingSpec.swift rename to Tests/RxAutomatonTests/EffectMappingSpec.swift index 3f36289..dea6e4d 100644 --- a/Tests/RxAutomatonTests/NextMappingSpec.swift +++ b/Tests/RxAutomatonTests/EffectMappingSpec.swift @@ -1,5 +1,5 @@ // -// NextMappingSpec.swift +// EffectMappingSpec.swift // RxAutomaton // // Created by Yasuhiro Inami on 2016-08-15. @@ -14,19 +14,19 @@ import Nimble /// Tests for `(State, Input) -> (State, Output)?` mapping /// where `Output = Observable`. -class NextMappingSpec: QuickSpec +class EffectMappingSpec: QuickSpec { override func spec() { typealias Automaton = RxAutomaton.Automaton - typealias NextMapping = Automaton.NextMapping + typealias EffectMapping = Automaton.EffectMapping let (signal, observer) = Observable.pipe() var automaton: Automaton? var lastReply: Reply? var testScheduler: TestScheduler! - describe("Syntax-sugar NextMapping") { + describe("Syntax-sugar EffectMapping") { beforeEach { testScheduler = TestScheduler() @@ -41,7 +41,7 @@ class NextMappingSpec: QuickSpec Observable.just(AuthInput.logoutOK) .delay(1, onScheduler: testScheduler) - let mappings: [Automaton.NextMapping] = [ + let mappings: [Automaton.EffectMapping] = [ .login | .loggedOut => .loggingIn | loginOKProducer, .loginOK | .loggingIn => .loggedIn | .empty(), .logout | .loggedIn => .loggingOut | logoutOKProducer, @@ -95,7 +95,7 @@ class NextMappingSpec: QuickSpec } - describe("Func-based NextMapping") { + describe("Func-based EffectMapping") { beforeEach { testScheduler = TestScheduler() @@ -110,7 +110,7 @@ class NextMappingSpec: QuickSpec Observable.just(AuthInput.logoutOK) .delay(1, onScheduler: testScheduler) - let mapping: NextMapping = { fromState, input in + let mapping: EffectMapping = { fromState, input in switch (fromState, input) { case (.loggedOut, .login): return (.loggingIn, loginOKProducer) @@ -173,7 +173,7 @@ class NextMappingSpec: QuickSpec } /// https://github.com/inamiy/RxAutomaton/issues/3 - describe("Next-producer should be called only once per input") { + describe("Additional effect should be called only once per input") { var effectCallCount = 0 @@ -192,12 +192,12 @@ class NextMappingSpec: QuickSpec }) } - let mappings: [Automaton.NextMapping] = [ + let mappings: [Automaton.EffectMapping] = [ .login | .loggedOut => .loggingIn | loginOKProducer, .loginOK | .loggingIn => .loggedIn | .empty(), ] - // strategy = `.Merge` + // strategy = `.merge` automaton = Automaton(state: .loggedOut, input: signal, mapping: reduce(mappings), strategy: .merge) _ = automaton?.replies.observeValues { reply in diff --git a/Tests/RxAutomatonTests/StateFuncMappingSpec.swift b/Tests/RxAutomatonTests/StateFuncMappingSpec.swift index 1e596bb..8e70385 100644 --- a/Tests/RxAutomatonTests/StateFuncMappingSpec.swift +++ b/Tests/RxAutomatonTests/StateFuncMappingSpec.swift @@ -20,13 +20,13 @@ class StateFuncMappingSpec: QuickSpec describe("State-change function mapping") { typealias Automaton = RxAutomaton.Automaton - typealias NextMapping = Automaton.NextMapping + typealias EffectMapping = Automaton.EffectMapping let (signal, observer) = Observable.pipe() var automaton: Automaton? beforeEach { - let mappings: [Automaton.NextMapping] = [ + let mappings: [Automaton.EffectMapping] = [ .increment | { $0 + 1 } | .empty(), .decrement | { $0 - 1 } | .empty(), ] diff --git a/Tests/RxAutomatonTests/TerminatingSpec.swift b/Tests/RxAutomatonTests/TerminatingSpec.swift index 75672bb..997294d 100644 --- a/Tests/RxAutomatonTests/TerminatingSpec.swift +++ b/Tests/RxAutomatonTests/TerminatingSpec.swift @@ -22,8 +22,8 @@ class TerminatingSpec: QuickSpec var lastReply: Reply? var lastRepliesEvent: Event>? - /// Flag for internal nextProducer `sendInput1And2AfterDelay` disposed. -// var nextProducerDisposed: Bool? + /// Flag for internal effect `sendInput1And2AfterDelay` disposed. +// var effectDisposed: Bool? var signal: Observable! var observer: AnyObserver! @@ -43,7 +43,7 @@ class TerminatingSpec: QuickSpec Observable.just(.input2).delay(1, onScheduler: testScheduler), ]) - let mappings: [Automaton.NextMapping] = [ + let mappings: [Automaton.EffectMapping] = [ .input0 | .state0 => .state1 | sendInput1And2AfterDelay, .input1 | .state1 => .state2 | .empty(), .input2 | .state2 => .state0 | .empty() @@ -62,7 +62,7 @@ class TerminatingSpec: QuickSpec lastReply = nil lastRepliesEvent = nil -// nextProducerDisposed = false +// effectDisposed = false } describe("Automaton deinit") { @@ -84,14 +84,14 @@ class TerminatingSpec: QuickSpec expect(automaton?.state.value) == .state0 expect(lastReply).to(beNil()) expect(lastRepliesEvent).to(beNil()) -// expect(nextProducerDisposed) == false +// expect(effectDisposed) == false observer.send(next: .input0) expect(automaton?.state.value) == .state1 expect(lastReply?.input) == .input0 expect(lastRepliesEvent?.isTerminating) == false -// expect(nextProducerDisposed) == false +// expect(effectDisposed) == false // `sendInput1And2AfterDelay` will automatically send `.input1` at this point testScheduler.advanceByInterval(1) @@ -99,7 +99,7 @@ class TerminatingSpec: QuickSpec expect(automaton?.state.value) == .state2 expect(lastReply?.input) == .input1 expect(lastRepliesEvent?.isTerminating) == false -// expect(nextProducerDisposed) == false +// expect(effectDisposed) == false weak var weakAutomaton = automaton automaton = nil @@ -107,7 +107,7 @@ class TerminatingSpec: QuickSpec expect(weakAutomaton).to(beNil()) expect(lastReply?.input) == .input1 expect(lastRepliesEvent?.isCompleting) == true // isCompleting -// expect(nextProducerDisposed) == true +// expect(effectDisposed) == true // If `sendInput1And2AfterDelay` is still alive, it will send `.input2` at this point, // but it's already interrupted because `automaton` is deinited. @@ -140,14 +140,14 @@ class TerminatingSpec: QuickSpec // expect(automaton).toNot(beNil()) // expect(lastReply).to(beNil()) // expect(lastRepliesEvent).to(beNil()) -// expect(nextProducerDisposed) == false +// expect(effectDisposed) == false // // observer.send(next: .input0) // // expect(automaton?.state.value) == .state1 // expect(lastReply?.input) == .input0 // expect(lastRepliesEvent?.isTerminating) == false -// expect(nextProducerDisposed) == false +// expect(effectDisposed) == false // // // `sendInput1And2AfterDelay` will automatically send `.input1` at this point // testScheduler.advanceByInterval(1) @@ -155,14 +155,14 @@ class TerminatingSpec: QuickSpec // expect(automaton?.state.value) == .state2 // expect(lastReply?.input) == .input1 // expect(lastRepliesEvent?.isTerminating) == false -// expect(nextProducerDisposed) == false +// expect(effectDisposed) == false // // observer.sendInterrupted() // // expect(automaton?.state.value) == .state2 // expect(lastReply?.input) == .input1 //// expect(lastRepliesEvent?.isInterrupting) == true // interrupting, not isCompleting -// expect(nextProducerDisposed) == true +// expect(effectDisposed) == true // // // If `sendInput1And2AfterDelay` is still alive, it will send `.input2` at this point, // // but it's already interrupted because of `sendInterrupted`. @@ -176,7 +176,7 @@ class TerminatingSpec: QuickSpec // } // Unlike `automaton.deinit` or `inputSignal` sending `.Interrupted`, - // inputSignal` sending `.Completed` does NOT cancel internal nextProducer, + // inputSignal` sending `.Completed` does NOT cancel internal effect, // i.e. `sendInput1And2AfterDelay`. describe("inputSignal sendCompleted") { @@ -196,14 +196,14 @@ class TerminatingSpec: QuickSpec expect(automaton?.state.value) == .state0 expect(lastReply).to(beNil()) expect(lastRepliesEvent).to(beNil()) -// expect(nextProducerDisposed) == false +// expect(effectDisposed) == false observer.send(next: .input0) expect(automaton?.state.value) == .state1 expect(lastReply?.input) == .input0 expect(lastRepliesEvent?.isTerminating) == false -// expect(nextProducerDisposed) == false +// expect(effectDisposed) == false // `sendInput1And2AfterDelay` will automatically send `.input1` at this point. testScheduler.advanceByInterval(1) @@ -211,7 +211,7 @@ class TerminatingSpec: QuickSpec expect(automaton?.state.value) == .state2 expect(lastReply?.input) == .input1 expect(lastRepliesEvent?.isTerminating) == false -// expect(nextProducerDisposed) == false +// expect(effectDisposed) == false observer.sendCompleted() @@ -219,7 +219,7 @@ class TerminatingSpec: QuickSpec expect(automaton?.state.value) == .state2 expect(lastReply?.input) == .input1 expect(lastRepliesEvent?.isTerminating) == false -// expect(nextProducerDisposed) == false +// expect(effectDisposed) == false // `sendInput1And2AfterDelay` will automatically send `.input2` at this point. testScheduler.advanceByInterval(2) @@ -228,7 +228,7 @@ class TerminatingSpec: QuickSpec expect(automaton?.state.value) == .state0 expect(lastReply?.input) == .input2 expect(lastRepliesEvent?.isCompleting) == true -// expect(nextProducerDisposed) == true +// expect(effectDisposed) == true } }