Skip to content

Commit

Permalink
test trying to construct array with undef but no element type (#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
nsajko authored Feb 1, 2025
1 parent ffb5004 commit ee6bcd9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit ee6bcd9

Please sign in to comment.