Fix chunks(countOf: 1) (#293)

This commit is contained in:
Franz Busch authored and GitHub committed 2023-09-19 17:23:38 +02:00
1 parent 4a1fb99f00
commit 281e27c5d0
2 files changed
+12

No files matched your search

@@ -49,6 +49,10 @@ public struct AsyncChunksOfCountSequence<Base: AsyncSequence, Collected: RangeRe
return nil
}
if count == 1 {
return Collected(CollectionOfOne(first))
}
var result: Collected = .init()
result.append(first)
@@ -24,6 +24,14 @@ func concatCharacters(_ array: [String]) -> String {
}
final class TestChunk: XCTestCase {
func test_count_one() {
validate {
"ABCDE|"
$0.inputs[0].chunks(ofCount: 1).map(concatCharacters)
"ABCDE|"
}
}
func test_signal_equalChunks() {
validate {
"ABC- DEF- GHI- |"