Skip to content

Commit

Permalink
Preserve newline
Browse files Browse the repository at this point in the history
  • Loading branch information
mverzilli committed Feb 10, 2025
1 parent bd49efc commit f895649
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions spec/compiler/formatter/formatter_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -1118,6 +1118,7 @@ describe Crystal::Formatter do
assert_format "a = \\\n # foo\n nil"
assert_format "a : String = if 1\n\"One\"\nelse\"Zero\"\nend", "a : String = if 1\n \"One\"\n else\n \"Zero\"\n end"
assert_format "a : String = case 1\nwhen 2\n3\nend", "a : String = case 1\n when 2\n 3\n end"
assert_format "a : String = \nif 1\n1\nelse\n2\nend", "a : String =\n if 1\n 1\n else\n 2\n end"

assert_format %(require "foo"), %(require "foo")

Expand Down
2 changes: 1 addition & 1 deletion src/compiler/crystal/tools/formatter.cr
Original file line number Diff line number Diff line change
Expand Up @@ -3649,7 +3649,7 @@ module Crystal
if value = node.value
skip_space
check :OP_EQ
next_token_skip_space_or_newline
next_token_skip_space
write " ="
accept_assign_value_after_equals value
end
Expand Down

0 comments on commit f895649

Please sign in to comment.