@@ -2,39 +2,39 @@ import Test
2
2
@testable import Stream
3
3
4
4
test. case ( " LimitedBy " ) {
5
- let stream = ByteArrayInputStream ( [ UInt8 ] ( " Hello, World! " . utf8 ) )
5
+ let stream = ByteArrayInputStream ( " Hello, World! " ) as StreamReader
6
6
let hello = try await stream. withSubStreamReader ( limitedBy: 5 ) { stream in
7
7
return try await stream. readUntilEnd ( as: String . self)
8
8
}
9
- try stream. consume ( count: 2 )
9
+ try await stream. consume ( count: 2 )
10
10
let world = try await stream. readUntilEnd ( as: String . self)
11
11
expect ( hello == " Hello " )
12
12
expect ( world == " World! " )
13
13
}
14
14
15
15
test. case ( " SizedBy " ) {
16
16
let bytes = [ 0x00 , 0x05 ] + [ UInt8] ( " Hello, World! " . utf8)
17
- let stream = ByteArrayInputStream ( bytes)
17
+ let stream = ByteArrayInputStream ( bytes) as StreamReader
18
18
let hello = try await stream. withSubStreamReader ( sizedBy: UInt16 . self)
19
19
{ stream in
20
20
return try await stream. readUntilEnd ( as: String . self)
21
21
}
22
- try stream. consume ( count: 2 )
22
+ try await stream. consume ( count: 2 )
23
23
let world = try await stream. readUntilEnd ( as: String . self)
24
24
expect ( hello == " Hello " )
25
25
expect ( world == " World! " )
26
26
}
27
27
28
28
test. case ( " SizedByIncludingHeader " ) {
29
29
let bytes = [ 0x00 , 0x07 ] + [ UInt8] ( " Hello, World! " . utf8)
30
- let stream = ByteArrayInputStream ( bytes)
30
+ let stream = ByteArrayInputStream ( bytes) as StreamReader
31
31
let hello = try await stream. withSubStreamReader (
32
32
sizedBy: UInt16 . self,
33
33
includingHeader: true )
34
34
{ stream in
35
35
return try await stream. readUntilEnd ( as: String . self)
36
36
}
37
- try stream. consume ( count: 2 )
37
+ try await stream. consume ( count: 2 )
38
38
let world = try await stream. readUntilEnd ( as: String . self)
39
39
expect ( hello == " Hello " )
40
40
expect ( world == " World! " )
0 commit comments