Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Roger-luo committed Dec 5, 2020
1 parent 5a4db1d commit 5469789
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/print.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ function _print(f::MbyFunc, io::IO, a::AbstractDict,
value = a[key]
if is_table(value)
push!(ks, String(key))
header = !all(is_tabular(v) for v in values(value))::Bool
header = isempty(value) || !all(is_tabular(v) for v in values(value))::Bool
if header
# print table
first_block || println(io)
Expand Down
10 changes: 10 additions & 0 deletions test/print.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,13 @@ end
"""

@test toml_str(Dict("b" => SubString("foo"))) == "b = \"foo\"\n"

@testset "empty dict print" begin
s = """
user = "me"
[julia]
[option]
"""
d = TOML.parse(s)
@test toml_str(d) == "user = \"me\"\n\n[julia]\n\n[option]\n"
end

0 comments on commit 5469789

Please sign in to comment.