Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

Commit

Permalink
Recorder: rephrase failure cases
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-araman committed Aug 7, 2021
1 parent 58634da commit 9329e04
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Tests/CombineCloudKitTests/Simulation/Recorder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class Recorder<P>: Subscriber where P: Publisher {
public let finished = XCTestExpectation()

init(_ publisher: P) {
finished.assertForOverFulfill = true
publisher.receive(subscriber: self)
}

Expand All @@ -33,19 +34,17 @@ class Recorder<P>: Subscriber where P: Publisher {
}

func receive(_ input: Input) -> Subscribers.Demand {
guard completion == nil else {
if completion != nil {
XCTFail("Element received after completion.")
return .unlimited
}

elements.append(input)
return .unlimited
}

func receive(completion: Subscribers.Completion<Failure>) {
guard self.completion == nil else {
if self.completion != nil {
XCTFail("Another completion received after initial completion.")
return
}

self.completion = completion
Expand Down

0 comments on commit 9329e04

Please sign in to comment.