Skip to content

Commit 010edd5

Browse files
committed
fix parsing of empty table and respective test
1 parent 22cd2cd commit 010edd5

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

src/StippleActiveTables.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ mutable struct ActiveTable
2626
data::DataFrame
2727
end
2828

29+
ActiveTable() = ActiveTable(DataFrame())
30+
2931
register_normal_element("active__table", context = @__MODULE__)
3032

3133
function activetable(data::Symbol, args...; kwargs...)
@@ -38,6 +40,7 @@ function Stipple.render(at::ActiveTable)
3840
end
3941

4042
function Stipple.stipple_parse(::Type{ActiveTable}, v::Vector)
43+
isempty(v) && return ActiveTable(DataFrame())
4144
ActiveTable(DataFrame(permutedims(reduce(hcat, v[2:end])), v[1]))
4245
end
4346

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ using Stipple
4949

5050
# Test empty vector
5151
empty_at = Stipple.stipple_parse(ActiveTable, [])
52-
@test empty_at == DataFrame
52+
@test empty_at.data == DataFrame()
5353
end
5454

5555
@testset "Round-trip conversion" begin

0 commit comments

Comments
 (0)