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 @@ -1613,6 +1613,10 @@ defmodule Code.Formatter do
1613
1613
color ( string , :number , inspect_otps )
1614
1614
end
1615
1615
1616
+ defp insert_underscores ( "-" <> digits ) do
1617
+ "-" <> insert_underscores ( digits )
1618
+ end
1619
+
1616
1620
defp insert_underscores ( digits ) do
1617
1621
cond do
1618
1622
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