@@ -16,13 +16,12 @@ import XCTest
1616import Foundation
1717
1818final class Test_ServerSentEventsDecoding : Test_Runtime {
19- func _test( input: String , output: [ ServerSentEvent ] , file: StaticString = #filePath, line: UInt = #line, while predicate: ( ArraySlice < UInt8 > ) -> Bool = { _ in true } , eventCountOffset : Int = 0 )
19+ func _test( input: String , output: [ ServerSentEvent ] , file: StaticString = #filePath, line: UInt = #line, while predicate: @escaping @ Sendable ( ArraySlice < UInt8 > ) -> Bool = { _ in true } )
2020 async throws
2121 {
22- let sequence = asOneBytePerElementSequence ( ArraySlice ( input. utf8) ) . asDecodedServerSentEvents ( )
22+ let sequence = asOneBytePerElementSequence ( ArraySlice ( input. utf8) ) . asDecodedServerSentEvents ( while : predicate )
2323 let events = try await [ ServerSentEvent] ( collecting: sequence)
24- let eventCount = events. count + eventCountOffset
25- XCTAssertEqual ( eventCount, output. count, file: file, line: line)
24+ XCTAssertEqual ( events. count, output. count, file: file, line: line)
2625 for (index, linePair) in zip ( events, output) . enumerated ( ) {
2726 let ( actualEvent, expectedEvent) = linePair
2827 XCTAssertEqual ( actualEvent, expectedEvent, " Event: \( index) " , file: file, line: line)
@@ -103,8 +102,7 @@ final class Test_ServerSentEventsDecoding: Test_Runtime {
103102 ] ,
104103 while: { incomingData in
105104 incomingData != ArraySlice < UInt8 > ( Data ( " [DONE] " . utf8) )
106- } ,
107- eventCountOffset: - 2
105+ }
108106 )
109107 }
110108 func _testJSONData< JSONType: Decodable & Hashable & Sendable > (
0 commit comments