mirror of
https://github.com/apple/swift-async-algorithms
synced 2026-11-22 04:10:40 +00:00
Fix chunks(countOf: 1) (#293)
This commit is contained in:
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- |"
|
||||
|
||||
Reference in new issue
Block a user