Skip to content

Commit

Permalink
Merge pull request #23 from mrufsvold/fix-two-layer-single-name-bug
Browse files Browse the repository at this point in the history
fix: not adding names to path when only
  • Loading branch information
mrufsvold committed Jun 6, 2023
2 parents d56e8b6 + f262878 commit da2666e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,9 @@ function process_dict!(step::UnpackStep{N,T,C}, instruction_stack) where {N,T,C}
names_num = length(child_nodes)
if names_num == 0
push!(instruction_stack, column_set_step(ColumnSet()))
elseif names_num > 1
push!(instruction_stack, merge_instruction(get_name(step), length(child_nodes), level))
return nothing
end
push!(instruction_stack, merge_instruction(get_name(step), length(child_nodes), level))

for child_node in child_nodes
name = get_name(child_node)
Expand Down
12 changes: 12 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,18 @@ const heterogenous_level_test_body = Dict(
:b => 5
)
@test unordered_equal(EN.expand(empty_dict_field), (b = [5],))

@test begin
two_layer_deep = Dict(
:a => Dict(
:b => Dict(
:c => 1,
:d => 2,
)
)
)
unordered_equal(EN.expand(two_layer_deep), (a_b_c = [1], a_b_d = [2]))
end
end


Expand Down

0 comments on commit da2666e

Please sign in to comment.