Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/OffsetArrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,9 @@ function Base.showarg(io::IO, a::OffsetArray, toplevel)
Base.showarg(io, parent(a), false)
Base.showindices(io, axes(a)...)
print(io, ')')
toplevel && print(io, " with eltype ", eltype(a))
if toplevel
print(io, " with eltype ", eltype(a))
end
end

function Base.replace_in_print_matrix(A::OffsetArray{<:Any,2}, i::Integer, j::Integer, s::AbstractString)
Expand Down
6 changes: 6 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -929,6 +929,12 @@ end
v = rand(3)
ov = OffsetArray(v, (-2,))
@test Base.replace_in_print_matrix(ov, -1, 1, " ") == Base.replace_in_print_matrix(v, 1, 1, " ")

# Avoid returning the value of toplevel if it is false
# showarg should only print values, it shouldn't return anything
@test Base.showarg(io, a, false) === nothing
# check the other case too for good measure
@test Base.showarg(io, a, true) === nothing
end

@testset "readdlm/writedlm" begin
Expand Down