|
9 | 9 | source = IOBuffer("foo")
|
10 | 10 | stream = TranscodingStream(Noop(), source)
|
11 | 11 | @test !eof(stream)
|
12 |
| - @test read(stream) == b"foo" |
| 12 | + @test read(stream) == bb"foo" |
13 | 13 | close(stream)
|
14 | 14 |
|
15 | 15 | data = rand(UInt8, 100_000)
|
|
28 | 28 | @test read(stream, UInt8) === UInt8('f')
|
29 | 29 | data = Vector{UInt8}(undef, 5)
|
30 | 30 | unsafe_read(stream, pointer(data), 5) === nothing
|
31 |
| - @test data == b"oobar" |
| 31 | + @test data == bb"oobar" |
32 | 32 | close(stream)
|
33 | 33 |
|
34 | 34 | sink = IOBuffer()
|
35 | 35 | stream = TranscodingStream(Noop(), sink)
|
36 | 36 | @test write(stream, "foo") === 3
|
37 | 37 | @test occursin("mode=write", repr(stream))
|
38 | 38 | flush(stream)
|
39 |
| - @test take!(sink) == b"foo" |
| 39 | + @test take!(sink) == bb"foo" |
40 | 40 | close(stream)
|
41 | 41 |
|
42 | 42 | data = rand(UInt8, 100_000)
|
|
49 | 49 | @test take!(sink) == data
|
50 | 50 | close(stream)
|
51 | 51 |
|
52 |
| - stream = TranscodingStream(Noop(), IOBuffer(b"foobarbaz")) |
| 52 | + stream = TranscodingStream(Noop(), IOBuffer(bb"foobarbaz")) |
53 | 53 | @test position(stream) === 0
|
54 | 54 | read(stream, UInt8)
|
55 | 55 | @test position(stream) === 1
|
|
71 | 71 | @test !ismarked(stream)
|
72 | 72 | close(stream)
|
73 | 73 |
|
74 |
| - stream = TranscodingStream(Noop(), IOBuffer(b"foobarbaz")) |
| 74 | + stream = TranscodingStream(Noop(), IOBuffer(bb"foobarbaz")) |
75 | 75 | seek(stream, 2)
|
76 |
| - @test read(stream, 3) == b"oba" |
| 76 | + @test read(stream, 3) == bb"oba" |
77 | 77 | seek(stream, 0)
|
78 |
| - @test read(stream, 3) == b"foo" |
| 78 | + @test read(stream, 3) == bb"foo" |
79 | 79 | seekstart(stream)
|
80 |
| - @test read(stream, 3) == b"foo" |
| 80 | + @test read(stream, 3) == bb"foo" |
81 | 81 | seekend(stream)
|
82 | 82 | @test eof(stream)
|
83 | 83 | close(stream)
|
|
116 | 116 | out = zeros(UInt8, 3)
|
117 | 117 | @test bytesavailable(stream) == 0
|
118 | 118 | @test TranscodingStreams.unsafe_read(stream, pointer(out), 10) == 3
|
119 |
| - @test out == b"foo" |
| 119 | + @test out == bb"foo" |
120 | 120 | close(stream)
|
121 | 121 |
|
122 | 122 | data = rand(UInt8, 1999)
|
|
132 | 132 | close(stream)
|
133 | 133 |
|
134 | 134 | stream = NoopStream(NoopStream(IOBuffer("foobar")))
|
135 |
| - @test read(stream) == b"foobar" |
| 135 | + @test read(stream) == bb"foobar" |
136 | 136 | close(stream)
|
137 | 137 |
|
138 | 138 | stream = NoopStream(NoopStream(NoopStream(IOBuffer("foobar"))))
|
139 |
| - @test read(stream) == b"foobar" |
| 139 | + @test read(stream) == bb"foobar" |
140 | 140 | close(stream)
|
141 | 141 |
|
142 | 142 | # Two buffers are the same object.
|
|
151 | 151 | @test s1.state.buffer1 === s2.state.buffer1 === s3.state.buffer1 ===
|
152 | 152 | s1.state.buffer2 === s2.state.buffer2 === s3.state.buffer2
|
153 | 153 |
|
154 |
| - stream = TranscodingStream(Noop(), IOBuffer(b"foobar")) |
| 154 | + stream = TranscodingStream(Noop(), IOBuffer(bb"foobar")) |
155 | 155 | @test TranscodingStreams.stats(stream).in === Int64(0)
|
156 | 156 | @test TranscodingStreams.stats(stream).out === Int64(0)
|
157 | 157 | read(stream)
|
|
162 | 162 | stream = TranscodingStream(Noop(), IOBuffer())
|
163 | 163 | @test TranscodingStreams.stats(stream).in === Int64(0)
|
164 | 164 | @test TranscodingStreams.stats(stream).out === Int64(0)
|
165 |
| - write(stream, b"foobar") |
| 165 | + write(stream, bb"foobar") |
166 | 166 | flush(stream)
|
167 | 167 | @test TranscodingStreams.stats(stream).in === Int64(6)
|
168 | 168 | @test TranscodingStreams.stats(stream).out === Int64(6)
|
|
176 | 176 |
|
177 | 177 | stream = NoopStream(IOBuffer("foobar"))
|
178 | 178 | @test bytesavailable(stream) === 0
|
179 |
| - @test readavailable(stream) == b"" |
| 179 | + @test readavailable(stream) == bb"" |
180 | 180 | @test read(stream, UInt8) === UInt8('f')
|
181 | 181 | @test bytesavailable(stream) === 5
|
182 |
| - @test readavailable(stream) == b"oobar" |
| 182 | + @test readavailable(stream) == bb"oobar" |
183 | 183 | close(stream)
|
184 | 184 |
|
185 |
| - data = b"" |
| 185 | + data = bb"" |
186 | 186 | @test transcode(Noop, data) == data
|
187 | 187 | @test transcode(Noop, data) !== data
|
188 |
| - data = b"foo" |
| 188 | + data = bb"foo" |
189 | 189 | @test transcode(Noop, data) == data
|
190 | 190 | @test transcode(Noop, data) !== data
|
191 | 191 |
|
192 |
| - data = b"" |
| 192 | + data = bb"" |
193 | 193 | @test transcode(Noop(), data) == data
|
194 | 194 | @test transcode(Noop(), data) !== data
|
195 |
| - data = b"foo" |
| 195 | + data = bb"foo" |
196 | 196 | @test transcode(Noop(), data) == data
|
197 | 197 | @test transcode(Noop(), data) !== data
|
198 | 198 |
|
|
202 | 202 | TranscodingStreams.test_roundtrip_lines(NoopStream, NoopStream)
|
203 | 203 |
|
204 | 204 | # switch write => read
|
205 |
| - stream = NoopStream(Compat.IOBuffer(b"foobar", read=true, write=true)) |
| 205 | + stream = NoopStream(IOBuffer(bb"foobar", read=true, write=true)) |
206 | 206 | @test_throws ArgumentError begin
|
207 |
| - write(stream, b"xyz") |
| 207 | + write(stream, bb"xyz") |
208 | 208 | read(stream, 3)
|
209 | 209 | end
|
210 | 210 |
|
211 | 211 | # switch read => write
|
212 |
| - stream = NoopStream(Compat.IOBuffer(b"foobar", read=true, write=true)) |
| 212 | + stream = NoopStream(IOBuffer(bb"foobar", read=true, write=true)) |
213 | 213 | @test_throws ArgumentError begin
|
214 | 214 | read(stream, 3)
|
215 |
| - write(stream, b"xyz") |
| 215 | + write(stream, bb"xyz") |
216 | 216 | end
|
217 | 217 |
|
218 | 218 | stream = NoopStream(IOBuffer(""))
|
219 |
| - @test TranscodingStreams.unread(stream, b"foo") === nothing |
220 |
| - @test read(stream, 3) == b"foo" |
| 219 | + @test TranscodingStreams.unread(stream, bb"foo") === nothing |
| 220 | + @test read(stream, 3) == bb"foo" |
221 | 221 | close(stream)
|
222 | 222 |
|
223 | 223 | stream = NoopStream(IOBuffer("foo"))
|
224 |
| - @test read(stream, 3) == b"foo" |
225 |
| - @test TranscodingStreams.unread(stream, b"bar") === nothing |
226 |
| - @test read(stream, 3) == b"bar" |
| 224 | + @test read(stream, 3) == bb"foo" |
| 225 | + @test TranscodingStreams.unread(stream, bb"bar") === nothing |
| 226 | + @test read(stream, 3) == bb"bar" |
227 | 227 | close(stream)
|
228 | 228 |
|
229 | 229 | stream = NoopStream(IOBuffer("foobar"))
|
230 |
| - @test TranscodingStreams.unread(stream, b"baz") === nothing |
231 |
| - @test read(stream, 3) == b"baz" |
232 |
| - @test read(stream, 3) == b"foo" |
233 |
| - @test read(stream, 3) == b"bar" |
| 230 | + @test TranscodingStreams.unread(stream, bb"baz") === nothing |
| 231 | + @test read(stream, 3) == bb"baz" |
| 232 | + @test read(stream, 3) == bb"foo" |
| 233 | + @test read(stream, 3) == bb"bar" |
234 | 234 | @test eof(stream)
|
235 | 235 | close(stream)
|
236 | 236 |
|
237 | 237 | stream = NoopStream(IOBuffer("foobar"))
|
238 |
| - @test read(stream, 3) == b"foo" |
239 |
| - @test TranscodingStreams.unread(stream, b"baz") === nothing |
240 |
| - @test read(stream, 3) == b"baz" |
241 |
| - @test read(stream, 3) == b"bar" |
| 238 | + @test read(stream, 3) == bb"foo" |
| 239 | + @test TranscodingStreams.unread(stream, bb"baz") === nothing |
| 240 | + @test read(stream, 3) == bb"baz" |
| 241 | + @test read(stream, 3) == bb"bar" |
242 | 242 | @test eof(stream)
|
243 | 243 | close(stream)
|
244 | 244 |
|
245 | 245 | stream = NoopStream(IOBuffer("foobar"))
|
246 |
| - @test read(stream, 3) == b"foo" |
247 |
| - @test read(stream, 3) == b"bar" |
248 |
| - @test TranscodingStreams.unread(stream, b"baz") === nothing |
249 |
| - @test read(stream, 3) == b"baz" |
| 246 | + @test read(stream, 3) == bb"foo" |
| 247 | + @test read(stream, 3) == bb"bar" |
| 248 | + @test TranscodingStreams.unread(stream, bb"baz") === nothing |
| 249 | + @test read(stream, 3) == bb"baz" |
250 | 250 | @test eof(stream)
|
251 | 251 | close(stream)
|
252 | 252 |
|
253 | 253 | stream = NoopStream(IOBuffer("foobar"))
|
254 |
| - @test_throws ArgumentError TranscodingStreams.unsafe_unread(stream, pointer(b"foo"), -1) |
| 254 | + @test_throws ArgumentError TranscodingStreams.unsafe_unread(stream, pointer(bb"foo"), -1) |
255 | 255 | close(stream)
|
256 | 256 |
|
257 | 257 | stream = NoopStream(IOBuffer(""))
|
|
0 commit comments