Browse Source

Fix multiline string recursion with triple strings on one line

pull/30/head
Fredrik Ekre 1 year ago
parent
commit
ad5fe4d065
No known key found for this signature in database
GPG Key ID: DE82E6D5E364C0A2
  1. 3
      src/chisels.jl
  2. 5
      test/runtests.jl

3
src/chisels.jl

@ -523,9 +523,8 @@ function contains_multiline_triple_string(ctx, node::Node) @@ -523,9 +523,8 @@ function contains_multiline_triple_string(ctx, node::Node)
if endswith(String(read_bytes(ctx, kid)), "\n")
return true
end
else
accept_node!(ctx, kid)
end
accept_node!(ctx, kid)
end
@assert position(ctx.fmt_io) == pos + span(node)
else

5
test/runtests.jl

@ -715,6 +715,11 @@ end @@ -715,6 +715,11 @@ end
for trip in ("\"\"\"", "```")
@test format_string("println(io, $(trip)\n$(sp)a\n$(sp)\n$(sp)b\n$(sp)$(trip))") ==
"println(\n io, $(trip)\n a\n\n b\n $(trip),\n)"
# Triple string on same line
for b in ("", "\$b", "\$(b)", "\$(b)c")
@test format_string("println(io, $(trip)a$b$(trip))") ==
"println(io, $(trip)a$b$(trip))"
end
end
end
end

Loading…
Cancel
Save