@@ -846,13 +846,37 @@ end
846
846
end
847
847
848
848
@testset " alignment for pairs" begin # (#22899)
849
- @test replstr ([1 => 22 ,33 => 4 ]) == " 2-element Array{Pair{$Int ,$Int },1}:\n 1=> 22\n 33=> 4 "
849
+ @test replstr ([1 => 22 ,33 => 4 ]) == " 2-element Array{Pair{$Int ,$Int },1}:\n 1 => 22\n 33 => 4 "
850
850
# first field may have "=>" in its representation
851
851
@test replstr (Pair[(1 => 2 )=> 3 , 4 => 5 ]) ==
852
- " 2-element Array{Pair,1}:\n (1=>2)=> 3\n 4=> 5"
852
+ " 2-element Array{Pair,1}:\n (1=>2) => 3\n 4 => 5"
853
853
@test replstr (Any[Dict (1 => 2 )=> (3 => 4 ), 1 => 2 ]) ==
854
- " 2-element Array{Any,1}:\n Dict(1=>2)=> (3=>4)\n 1=> 2 "
854
+ " 2-element Array{Any,1}:\n Dict(1=>2) => (3=>4)\n 1 => 2 "
855
855
# left-alignment when not using the "=>" symbol
856
856
@test replstr (Pair{Integer,Int64}[1 => 2 , 33 => 4 ]) ==
857
857
" 2-element Array{Pair{Integer,Int64},1}:\n Pair{Integer,Int64}(1, 2) \n Pair{Integer,Int64}(33, 4)"
858
858
end
859
+
860
+ @testset " display arrays non-compactly when size(⋅, 2) == 1" begin
861
+ # 0-dim
862
+ @test replstr (zeros (Complex{Int})) == " 0-dimensional Array{Complex{$Int },0}:\n 0 + 0im"
863
+ A = Array {Pair} (); A[] = 1 => 2
864
+ @test replstr (A) == " 0-dimensional Array{Pair,0}:\n 1 => 2"
865
+ # 1-dim
866
+ @test replstr (zeros (Complex{Int}, 2 )) ==
867
+ " 2-element Array{Complex{$Int },1}:\n 0 + 0im\n 0 + 0im"
868
+ @test replstr ([1 => 2 , 3 => 4 ]) == " 2-element Array{Pair{$Int ,$Int },1}:\n 1 => 2\n 3 => 4"
869
+ # 2-dim
870
+ @test replstr (zeros (Complex{Int}, 2 , 1 )) ==
871
+ " 2×1 Array{Complex{$Int },2}:\n 0 + 0im\n 0 + 0im"
872
+ @test replstr (zeros (Complex{Int}, 1 , 2 )) ==
873
+ " 1×2 Array{Complex{$Int },2}:\n 0+0im 0+0im"
874
+ @test replstr ([1 => 2 3 => 4 ]) == " 1×2 Array{Pair{$Int ,$Int },2}:\n 1=>2 3=>4"
875
+ @test replstr ([1 => 2 for x in 1 : 2 , y in 1 : 1 ]) ==
876
+ " 2×1 Array{Pair{$Int ,$Int },2}:\n 1 => 2\n 1 => 2"
877
+ # 3-dim
878
+ @test replstr (zeros (Complex{Int}, 1 , 1 , 1 )) ==
879
+ " 1×1×1 Array{Complex{$Int },3}:\n [:, :, 1] =\n 0 + 0im"
880
+ @test replstr (zeros (Complex{Int}, 1 , 2 , 1 )) ==
881
+ " 1×2×1 Array{Complex{$Int },3}:\n [:, :, 1] =\n 0+0im 0+0im"
882
+ end
0 commit comments