Skip to content

Commit

Permalink
Add bytesavailable (#483)
Browse files Browse the repository at this point in the history
  • Loading branch information
ararslan authored Feb 3, 2018
1 parent 0668f9c commit 19bad8c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down Expand Up @@ -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
6 changes: 6 additions & 0 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 19bad8c

Please sign in to comment.