diff --git a/test/runtests.jl b/test/runtests.jl index 5834365e..310ea0c1 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -204,8 +204,10 @@ include("infinitearrays.jl") @testset "promotion" begin Z = Zeros{Int}(5) Zf = Zeros(5) + @test promote_type(typeof(Z), typeof(Zf)) == typeof(Zf) O = Ones{Int}(5) Of = Ones{Float64}(5) + @test promote_type(typeof(O), typeof(Of)) == typeof(Of) @test [Z,O] isa Vector{Fill{Int,1,Tuple{Base.OneTo{Int}}}} @test [Z,Of] isa Vector{Fill{Float64,1,Tuple{Base.OneTo{Int}}}} @test [O,O] isa Vector{Ones{Int,1,Tuple{Base.OneTo{Int}}}} @@ -215,6 +217,10 @@ include("infinitearrays.jl") @test convert(Ones{Int}, Of) ≡ convert(Ones{Int,1}, Of) ≡ convert(typeof(O), Of) ≡ O @test convert(Zeros{Int}, Zf) ≡ convert(Zeros{Int,1}, Zf) ≡ convert(typeof(Z), Zf) ≡ Z + F = Fill(1, 2) + Ff = Fill(1.0, 2) + @test promote_type(typeof(F), typeof(Ff)) == typeof(Ff) + @test_throws MethodError convert(Zeros{SVector{2,Int}}, Zf) end end @@ -1566,4 +1572,4 @@ end @test Base.setindex(Zeros(5), 2, 2) ≡ OneElement(2.0, 2, 5) @test Base.setindex(Zeros(5,3), 2, 2, 3) ≡ OneElement(2.0, (2,3), (5,3)) @test_throws BoundsError Base.setindex(Zeros(5), 2, 6) -end \ No newline at end of file +end