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
24 changes: 24 additions & 0 deletions spec/compiler/parser/to_s_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,30 @@ describe "ASTNode#to_s" do
%}
CR

expect_to_s <<-'CR', <<-'CR'
{%
({"a" => "b"} of Nil => Nil).each do |k, v|
# stuff and things
k + v

# foo bar

k + v
end
%}
CR
{%
({"a" => "b"} of Nil => Nil).each do |k, v|

k + v



k + v
end
%}
CR

expect_to_s <<-'CR'
{%
vals = "foo".strip.strip.strip
Expand Down
2 changes: 2 additions & 0 deletions src/compiler/crystal/syntax/to_s.cr
Original file line number Diff line number Diff line change
Expand Up @@ -1195,6 +1195,8 @@ module Crystal
@str << '|'
end

write_extra_newlines node.location, node.body.location

if single_line_block
@str << ' '
node.body.accept self
Expand Down