From ee6bcd96638f97a78910d55a60a2d9f46fd7d7c3 Mon Sep 17 00:00:00 2001 From: Neven Sajko <4944410+nsajko@users.noreply.github.com> Date: Sat, 1 Feb 2025 14:06:20 +0100 Subject: [PATCH] test trying to construct array with `undef` but no element type (#97) --- test/runtests.jl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/runtests.jl b/test/runtests.jl index 62ab341..43b4dd3 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -150,6 +150,11 @@ end test_inferred(FixedSizeVector{Int}, return_type, arr) end + @testset "`undef` construction without element type" begin + @test_throws MethodError FixedSizeVector(undef, 1) + @test_throws MethodError FixedSizeMatrix(undef, 1, 1) + end + for storage_type ∈ (((@isdefined Memory) ? (Memory,) : ())..., Vector) FSV = fsv(storage_type) FSM = fsm(storage_type) @@ -167,6 +172,10 @@ end end @testset "Constructors" begin + @testset "`undef` construction without element type" begin + @test_throws MethodError FSV(undef, 1) + @test_throws MethodError FSM(undef, 1, 1) + end @testset "mismatched ndims" begin @test_throws MethodError FSV{Int}(undef) @test_throws MethodError FSV{Int}(undef, 1, 1)