From 69ed6ed6ee655ffa53ba9e28498ce1c15fb03e49 Mon Sep 17 00:00:00 2001 From: John Cobbler <44442232+JohnCobbler@users.noreply.github.com> Date: Fri, 5 Jun 2026 20:28:17 +0000 Subject: [PATCH] test: elementwise ops on mismatched sizes throw DimensionMismatch Co-authored-by: Claude --- test/testsuite/broadcasting.jl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/testsuite/broadcasting.jl b/test/testsuite/broadcasting.jl index e2a2d994..d5a890d2 100644 --- a/test/testsuite/broadcasting.jl +++ b/test/testsuite/broadcasting.jl @@ -132,6 +132,14 @@ function broadcasting(AT, eltypes) @test compare(A -> A .* ET(10), AT, rand(ET, 40, 40)) @test compare((A, B) -> A .* B, AT, rand(ET, 40, 40), rand(ET, 40, 40)) @test compare((A, B) -> A .* B .+ ET(10), AT, rand(ET, 40, 40), rand(ET, 40, 40)) + + @testset "mismatched sizes" begin + a = AT(rand(ET, 10, 1)) + b = AT(rand(ET, 3, 1)) + @test_throws DimensionMismatch a + b + @test_throws DimensionMismatch b + a + @test_throws DimensionMismatch a .+ b + end end @testset "map! $ET" begin