diff --git a/test/broadcast.jl b/test/broadcast.jl index 808571f3118d6..628003d4b47c5 100644 --- a/test/broadcast.jl +++ b/test/broadcast.jl @@ -152,15 +152,16 @@ for arr in (identity, as_sub) end end -r1 = 1:1 -r2 = 1:5 -ratio = [1,1/2,1/3,1/4,1/5] -@test r1.*r2 == [1:5;] -@test r1./r2 == ratio -m = [1:2;]' -@test m.*r2 == [1:5 2:2:10] -@test m./r2 ≈ [ratio 2ratio] -@test m./[r2;] ≈ [ratio 2ratio] +let r1 = 1:1, + r2 = 1:5, + ratio = [1,1/2,1/3,1/4,1/5], + m = [1:2;]' + @test r1.*r2 == [1:5;] + @test r1./r2 == ratio + @test m.*r2 == [1:5 2:2:10] + @test m./r2 ≈ [ratio 2ratio] + @test m./[r2;] ≈ [ratio 2ratio] +end @test @inferred(broadcast(+,[0,1.2],reshape([0,-2],1,1,2))) == reshape([0 -2; 1.2 -0.8],2,1,2) rt = Base.return_types(broadcast, Tuple{typeof(+), Array{Float64, 3}, Array{Int, 1}})