We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b80dd58 commit 6ac351aCopy full SHA for 6ac351a
base/io.jl
@@ -864,11 +864,10 @@ end
864
865
function write(io::IO, c::Char)
866
u = bswap(reinterpret(UInt32, c))
867
- n = 1
+ n = 0
868
while true
869
- write(io, u % UInt8)
+ n += write(io, u % UInt8)
870
(u >>= 8) == 0 && return n
871
- n += 1
872
end
873
874
# write(io, ::AbstractChar) is not defined: implementations
test/iobuffer.jl
@@ -399,3 +399,9 @@ end
399
io = IOBuffer(data)
400
@test read(io) == data
401
402
+
403
+@testset "Writing Char to full buffer" begin
404
+ io = IOBuffer(;maxsize=1)
405
+ write(io, 'a')
406
+ @test write(io, 'a') == 0
407
+end
0 commit comments