diff --git a/base/range.jl b/base/range.jl index 84ea19d65feb3..23735aaa87f1c 100644 --- a/base/range.jl +++ b/base/range.jl @@ -508,7 +508,7 @@ be an `Integer`. ```jldoctest julia> LinRange(1.5, 5.5, 9) 9-element LinRange{Float64, Int64}: - 1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0,5.5 + 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 5.5 ``` Compared to using [`range`](@ref), directly constructing a `LinRange` should @@ -592,7 +592,7 @@ as if it were `collect(r)`, dependent on the size of the terminal, and taking into account whether compact numbers should be shown. It figures out the width in characters of each element, and if they end up too wide, it shows the first and last elements separated by a -horizontal ellipsis. Typical output will look like `1.0,2.0,3.0,…,4.0,5.0,6.0`. +horizontal ellipsis. Typical output will look like `1.0, 2.0, …, 5.0, 6.0`. `print_range(io, r, pre, sep, post, hdots)` uses optional parameters `pre` and `post` characters for each printed row, @@ -601,9 +601,9 @@ parameters `pre` and `post` characters for each printed row, """ function print_range(io::IO, r::AbstractRange, pre::AbstractString = " ", - sep::AbstractString = ",", + sep::AbstractString = ", ", post::AbstractString = "", - hdots::AbstractString = ",\u2026,") # horiz ellipsis + hdots::AbstractString = ", \u2026, ") # horiz ellipsis # This function borrows from print_matrix() in show.jl # and should be called by show and display sz = displaysize(io) diff --git a/test/ranges.jl b/test/ranges.jl index c448f4b99e201..f84eaae46c321 100644 --- a/test/ranges.jl +++ b/test/ranges.jl @@ -1197,7 +1197,7 @@ end @test replrepr(1:4) == "1:4" @test repr("text/plain", 1:4) == "1:4" @test repr("text/plain", range(1, stop=5, length=7)) == "1.0:0.6666666666666666:5.0" - @test repr("text/plain", LinRange{Float64}(1,5,7)) == "7-element LinRange{Float64, Int$nb}:\n 1.0,1.66667,2.33333,3.0,3.66667,4.33333,5.0" + @test repr("text/plain", LinRange{Float64}(1,5,7)) == "7-element LinRange{Float64, Int$nb}:\n 1.0, 1.66667, 2.33333, 3.0, 3.66667, 4.33333, 5.0" @test repr(range(1, stop=5, length=7)) == "1.0:0.6666666666666666:5.0" @test repr(LinRange{Float64}(1,5,7)) == "LinRange{Float64}(1.0, 5.0, 7)" @test replrepr(0:100.) == "0.0:1.0:100.0" @@ -1205,7 +1205,7 @@ end # only examines spacing of the left and right edges of the range, sufficient # to cover the designated screen size. @test replrepr(range(0, stop=100, length=10000)) == "0.0:0.010001000100010001:100.0" - @test replrepr(LinRange{Float64}(0,100, 10000)) == "10000-element LinRange{Float64, Int$nb}:\n 0.0,0.010001,0.020002,0.030003,0.040004,…,99.95,99.96,99.97,99.98,99.99,100.0" + @test replrepr(LinRange{Float64}(0,100, 10000)) == "10000-element LinRange{Float64, Int$nb}:\n 0.0, 0.010001, 0.020002, 0.030003, …, 99.96, 99.97, 99.98, 99.99, 100.0" @test sprint(show, UnitRange(1, 2)) == "1:2" @test sprint(show, StepRange(1, 2, 5)) == "1:2:5"