Skip to content

Commit

Permalink
add a test
Browse files Browse the repository at this point in the history
  • Loading branch information
jrevels committed Dec 4, 2023
1 parent c4a215d commit 1244f94
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1015,5 +1015,27 @@ end

# end

@testset "# 493" begin
# This test stresses the existence of the mechanism
# implemented in https://github.com/apache/arrow-julia/pull/493,
# but doesn't stress the actual use case that motivates
# that mechanism, simply because it'd be more annoying to
# write that test; see the PR for details.
struct Foo493
x::Int
y::Int
end
Arrow.ArrowTypes.arrowname(::Type{Foo493}) = Symbol("JuliaLang.Foo493")
Arrow.ArrowTypes.JuliaType(::Val{Symbol("JuliaLang.Foo493")}, T) = Foo493
function Arrow.ArrowTypes.fromarrow(::Type{Foo493}, f::Arrow.StructElement)
return Foo493(f.fields.x + 1, f.fields.y + 1)
end
t = (; f=[Foo493(1, 2), Foo493(3, 4)])
buf = Arrow.tobuffer(t)
tbl = Arrow.Table(buf)
@test tbl.f[1] === Foo493(2, 3)
@test tbl.f[2] === Foo493(4, 5)
end

end # @testset "misc"
end

0 comments on commit 1244f94

Please sign in to comment.