From 19bad8cae3cbe15e1284c5a3776235a925e8f1bd Mon Sep 17 00:00:00 2001 From: Alex Arslan Date: Fri, 2 Feb 2018 20:53:02 -0800 Subject: [PATCH] Add bytesavailable (#483) --- README.md | 3 +++ src/Compat.jl | 6 ++++++ test/runtests.jl | 6 ++++++ 3 files changed, 15 insertions(+) diff --git a/README.md b/README.md index 15265e33dd433..1f7795178da37 100644 --- a/README.md +++ b/README.md @@ -328,6 +328,8 @@ Currently, the `@compat` macro supports the following syntaxes: * `endof` is now `lastindex` ([#25458]). (Note that `lastindex(A, n)` is not supported.) +* `nb_available` is now `bytesavailable` ([#25634]). + ## New macros * `@__DIR__` has been added ([#18380]) @@ -518,6 +520,7 @@ includes this fix. Find the minimum version from there. [#25622]: https://github.com/JuliaLang/julia/issues/25622 [#25628]: https://github.com/JuliaLang/julia/issues/25628 [#25629]: https://github.com/JuliaLang/julia/issues/25629 +[#25634]: https://github.com/JuliaLang/julia/issues/25634 [#25646]: https://github.com/JuliaLang/julia/issues/25646 [#25654]: https://github.com/JuliaLang/julia/issues/25654 [#24182]: https://github.com/JuliaLang/julia/issues/24182 diff --git a/src/Compat.jl b/src/Compat.jl index 4d31c60861a68..ea464cecd31f7 100644 --- a/src/Compat.jl +++ b/src/Compat.jl @@ -1497,6 +1497,12 @@ end export AbstractDisplay end +# 0.7.0-DEV.3481 +@static if !isdefined(Base, :bytesavailable) + const bytesavailable = nb_available + export bytesavailable +end + # 0.7.0-DEV.3583 @static if !isdefined(Base, :lastindex) const lastindex = endof diff --git a/test/runtests.jl b/test/runtests.jl index 8bbfb6749f638..a3a28a2064c2a 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1295,6 +1295,12 @@ end @test eltype(Base.Multimedia.displays) <: AbstractDisplay +# 0.7.0-DEV.3481 +let b = IOBuffer() + write(b, "hi") + @test bytesavailable(b) == 0 +end + # 0.7.0-DEV.3583 @test lastindex(zeros(4)) == 4 @test lastindex(zeros(4,4)) == 16