Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/structarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ struct StructArray{T, N, C<:Tup, I} <: AbstractArray{T, N}
components::C

function StructArray{T, N, C}(c) where {T, N, C<:Tup}
isempty(c) && error("Only eltypes with fields are supported")
isempty(c) && error("only eltypes with fields are supported")
ax = axes(first(c))
length(ax) == N || error("wrong number of dimensions")
map(tail(c)) do ci
Expand Down
7 changes: 5 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,8 @@ end
@test isequal(t.a, [1, missing])
@test eltype(t) <: NamedTuple{(:a,)}

@test_throws Exception StructArray([nothing])
@test_throws Exception StructArray([1, 2, 3])
@test_throws ErrorException StructArray([nothing])
@test_throws ErrorException StructArray([1, 2, 3])
end

@testset "tuple case" begin
Expand All @@ -456,6 +456,9 @@ end
@test getproperty(t, 2) == [3.0]

@test_throws ErrorException StructArray(([1, 2], [3]))

@test_throws ErrorException StructArray{Tuple{}}(())
@test_throws ErrorException StructArray{Tuple{}, 1, Tuple{}}(())
end

@testset "constructor from slices" begin
Expand Down