@@ -683,8 +683,8 @@ function test_cat(::Type{TestAbstractArray})
683
683
@test hcat () == Any[]
684
684
@test vcat (1 , 1.0 , 3 , 3.0 ) == [1.0 , 1.0 , 3.0 , 3.0 ]
685
685
@test hcat (1 , 1.0 , 3 , 3.0 ) == [1.0 1.0 3.0 3.0 ]
686
- @test_throws ArgumentError hcat (B1, B2)
687
- @test_throws ArgumentError vcat (C1, C2)
686
+ @test_throws DimensionMismatch hcat (B1, B2)
687
+ @test_throws DimensionMismatch vcat (C1, C2)
688
688
689
689
@test vcat (B) == B
690
690
@test hcat (B) == B
@@ -713,9 +713,9 @@ function test_cat(::Type{TestAbstractArray})
713
713
end
714
714
715
715
@test_throws ArgumentError hvcat (7 , 1 : 20 ... )
716
- @test_throws ArgumentError hvcat ((2 ), C1, C3)
717
- @test_throws ArgumentError hvcat ((1 ), C1, C2)
718
- @test_throws ArgumentError hvcat ((1 ), C2, C3)
716
+ @test_throws DimensionMismatch hvcat ((2 ), C1, C3)
717
+ @test_throws DimensionMismatch hvcat ((1 ), C1, C2)
718
+ @test_throws DimensionMismatch hvcat ((1 ), C2, C3)
719
719
720
720
tup = tuple (rand (1 : 10 , i)... )
721
721
@test hvcat (tup) == []
@@ -724,8 +724,8 @@ function test_cat(::Type{TestAbstractArray})
724
724
@test_throws ArgumentError hvcat ((2 , 2 ), 1 , 2 , 3 , 4 , 5 )
725
725
@test_throws ArgumentError Base. typed_hvcat (Int, (2 , 2 ), 1 , 2 , 3 , 4 , 5 )
726
726
# check for # of columns mismatch b/w rows
727
- @test_throws ArgumentError hvcat ((3 , 2 ), 1 , 2 , 3 , 4 , 5 , 6 )
728
- @test_throws ArgumentError Base. typed_hvcat (Int, (3 , 2 ), 1 , 2 , 3 , 4 , 5 , 6 )
727
+ @test_throws DimensionMismatch hvcat ((3 , 2 ), 1 , 2 , 3 , 4 , 5 , 6 )
728
+ @test_throws DimensionMismatch Base. typed_hvcat (Int, (3 , 2 ), 1 , 2 , 3 , 4 , 5 , 6 )
729
729
730
730
# 18395
731
731
@test isa (Any[" a" 5 ; 2 // 3 1.0 ][2 ,1 ], Rational{Int})
@@ -1344,7 +1344,7 @@ end
1344
1344
1345
1345
@test Int[t... ; 3 4 ] == [1 2 ; 3 4 ]
1346
1346
@test Int[0 t... ; t... 0 ] == [0 1 2 ; 1 2 0 ]
1347
- @test_throws ArgumentError Int[t... ; 3 4 5 ]
1347
+ @test_throws DimensionMismatch Int[t... ; 3 4 5 ]
1348
1348
end
1349
1349
1350
1350
@testset " issue #39896, modified getindex " begin
@@ -1398,15 +1398,15 @@ using Base: typed_hvncat
1398
1398
@test [1 ;;] == fill (1 , (1 ,1 ))
1399
1399
1400
1400
for v in (1 , fill (1 ), fill (1 ,1 ,1 ), fill (1 , 1 , 1 , 1 ))
1401
- @test_throws ArgumentError [v; v;; v]
1402
- @test_throws ArgumentError [v; v;; v; v; v]
1403
- @test_throws ArgumentError [v; v; v;; v; v]
1404
- @test_throws ArgumentError [v; v;; v; v;;; v; v;; v; v;; v; v]
1405
- @test_throws ArgumentError [v; v;; v; v;;; v; v]
1406
- @test_throws ArgumentError [v; v;; v; v;;; v; v; v;; v; v]
1407
- @test_throws ArgumentError [v; v;; v; v;;; v; v;; v; v; v]
1401
+ @test_throws DimensionMismatch [v; v;; v]
1402
+ @test_throws DimensionMismatch [v; v;; v; v; v]
1403
+ @test_throws DimensionMismatch [v; v; v;; v; v]
1404
+ @test_throws DimensionMismatch [v; v;; v; v;;; v; v;; v; v;; v; v]
1405
+ @test_throws DimensionMismatch [v; v;; v; v;;; v; v]
1406
+ @test_throws DimensionMismatch [v; v;; v; v;;; v; v; v;; v; v]
1407
+ @test_throws DimensionMismatch [v; v;; v; v;;; v; v;; v; v; v]
1408
1408
# ensure a wrong shape with the right number of elements doesn't pass through
1409
- @test_throws ArgumentError [v; v;; v; v;;; v; v; v; v]
1409
+ @test_throws DimensionMismatch [v; v;; v; v;;; v; v; v; v]
1410
1410
1411
1411
@test [v; v;; v; v] == fill (1 , ndims (v) == 3 ? (2 , 2 , 1 ) : (2 ,2 ))
1412
1412
@test [v; v;; v; v;;;] == fill (1 , 2 , 2 , 1 )
@@ -1474,7 +1474,7 @@ using Base: typed_hvncat
1474
1474
end
1475
1475
1476
1476
# reject shapes that don't nest evenly between levels (e.g. 1 + 2 does not fit into 2)
1477
- @test_throws ArgumentError hvncat (((1 , 2 , 1 ), (2 , 2 ), (4 ,)), true , [1 2 ], [3 ], [4 ], [1 2 ; 3 4 ])
1477
+ @test_throws DimensionMismatch hvncat (((1 , 2 , 1 ), (2 , 2 ), (4 ,)), true , [1 2 ], [3 ], [4 ], [1 2 ; 3 4 ])
1478
1478
1479
1479
# zero-length arrays are handled appropriately
1480
1480
@test [zeros (Int, 1 , 2 , 0 ) ;;; 1 3 ] == [1 3 ;;;]
@@ -1489,18 +1489,18 @@ using Base: typed_hvncat
1489
1489
for v1 ∈ (zeros (Int, 0 , 0 ), zeros (Int, 0 , 0 , 0 , 0 ), zeros (Int, 0 , 0 , 0 , 0 , 0 , 0 , 0 ))
1490
1490
for v2 ∈ (1 , [1 ])
1491
1491
for v3 ∈ (2 , [2 ])
1492
- @test_throws ArgumentError [v1 ;;; v2]
1493
- @test_throws ArgumentError [v1 ;;; v2 v3]
1494
- @test_throws ArgumentError [v1 v1 ;;; v2 v3]
1492
+ @test_throws DimensionMismatch [v1 ;;; v2]
1493
+ @test_throws DimensionMismatch [v1 ;;; v2 v3]
1494
+ @test_throws DimensionMismatch [v1 v1 ;;; v2 v3]
1495
1495
end
1496
1496
end
1497
1497
end
1498
1498
v1 = zeros (Int, 0 , 0 , 0 )
1499
1499
for v2 ∈ (1 , [1 ])
1500
1500
for v3 ∈ (2 , [2 ])
1501
- @test_throws ArgumentError [v1 ;;; v2 v3]
1502
- @test_throws ArgumentError [v1 ;;; v2]
1503
- @test_throws ArgumentError [v1 v1 ;;; v2 v3]
1501
+ @test_throws DimensionMismatch [v1 ;;; v2 v3]
1502
+ @test_throws DimensionMismatch [v1 ;;; v2]
1503
+ @test_throws DimensionMismatch [v1 v1 ;;; v2 v3]
1504
1504
end
1505
1505
end
1506
1506
@@ -1568,8 +1568,8 @@ using Base: typed_hvncat
1568
1568
@test Array {Int, 3} (undef, 0 , 0 , 0 ) == typed_hvncat (Int, 3 ) isa Array{Int, 3 }
1569
1569
1570
1570
# Issue 43933 - semicolon precedence mistake should produce an error
1571
- @test_throws ArgumentError [[1 1 ]; 2 ;; 3 ; [3 4 ]]
1572
- @test_throws ArgumentError [[1 ;;; 1 ]; 2 ;;; 3 ; [3 ;;; 4 ]]
1571
+ @test_throws DimensionMismatch [[1 1 ]; 2 ;; 3 ; [3 4 ]]
1572
+ @test_throws DimensionMismatch [[1 ;;; 1 ]; 2 ;;; 3 ; [3 ;;; 4 ]]
1573
1573
1574
1574
@test [[1 2 ; 3 4 ] [5 ; 6 ]; [7 8 ] 9 ;;;] == [1 2 5 ; 3 4 6 ; 7 8 9 ;;;]
1575
1575
0 commit comments