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
5 changes: 3 additions & 2 deletions stdlib/TOML/src/print.jl
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,10 @@ function printvalue(f::MbyFunc, io::IO, value::TOMLValue, sorted::Bool)
value isa AbstractFloat ? Base.print(io, isnan(value) ? "nan" :
isinf(value) ? string(value > 0 ? "+" : "-", "inf") :
Float64(value)) : # TOML specifies IEEE 754 binary64 for float
value isa AbstractString ? (Base.print(io, "\"");
value isa AbstractString ? (qmark = Base.contains(value, "\n") ? "\"\"\"" : "\"";
Base.print(io, qmark);
print_toml_escaped(io, value);
Base.print(io, "\"")) :
Base.print(io, qmark)) :
value isa AbstractDict ? print_inline_table(f, io, value, sorted) :
error("internal error in TOML printing, unhandled value")
end
Expand Down
10 changes: 10 additions & 0 deletions stdlib/TOML/test/print.jl
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,13 @@ LocalPkg = {path = "LocalPkg"}
"""
@test toml_str(d; sorted=true, inline_tables) == s
@test roundtrip(s)

# multiline strings (#55083)
s = """
a = \"\"\"lorem ipsum



alpha\"\"\"
"""
@test roundtrip(s)