File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -1583,6 +1583,10 @@ defmodule Code.Formatter do
1583
1583
insert_underscores ( int_part ) <> "." <> decimal_part
1584
1584
end
1585
1585
1586
+ defp insert_underscores ( "-" <> digits ) do
1587
+ "-" <> insert_underscores ( digits )
1588
+ end
1589
+
1586
1590
defp insert_underscores ( digits ) do
1587
1591
cond do
1588
1592
digits =~ "_" ->
Original file line number Diff line number Diff line change @@ -429,6 +429,16 @@ defmodule MacroTest do
429
429
test "converts quoted to string" do
430
430
assert Macro . to_string ( quote do: hello ( world ) ) == "hello(world)"
431
431
end
432
+
433
+ test "large number literals" do
434
+ # with quote
435
+ assert Macro . to_string ( quote do: 576_460_752_303_423_455 ) == "576_460_752_303_423_455"
436
+ assert Macro . to_string ( quote do: - 576_460_752_303_423_455 ) == "-576_460_752_303_423_455"
437
+
438
+ # without quote
439
+ assert Macro . to_string ( 576_460_752_303_423_455 ) == "576_460_752_303_423_455"
440
+ assert Macro . to_string ( - 576_460_752_303_423_455 ) == "-576_460_752_303_423_455"
441
+ end
432
442
end
433
443
434
444
describe "to_string/2" do
You can’t perform that action at this time.
0 commit comments