Skip to content

Commit

Permalink
Set an explicit width limit on Inspect.Algebra.
Browse files Browse the repository at this point in the history
  • Loading branch information
kzemek committed Apr 28, 2024
1 parent e89b2a6 commit 6c8eaa5
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/mix/tasks/es6_maps/format.ex
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ defmodule Mix.Tasks.Es6Maps.Format do
escape: false,
locals_without_parens: opts.locals_without_parens
)
|> Inspect.Algebra.format(:infinity)
|> Inspect.Algebra.format(98)
|> then(&File.write!(filepath, &1))
end

Expand Down
25 changes: 25 additions & 0 deletions test/es6_maps_test/test/format_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -147,5 +147,30 @@ defmodule Es6MapsTest.Format do
"""
end
'''

test_formatting "comments are not moved around",
original: """
defmodule Test do
use LoremIpsum,
lorem: [LoremIpsum],
ipsum: [
# Lorem Ipsum Dolor
LoremIpsumDolorSitAmetConsequaturAdipisciElit,
LoremIpsumDolorSitAmetConsequaturAdipisciElit,
LoremIpsumDolorSitAmetConsequaturAdipisciElit
]
end
"""

test_formatting "multiline list literals are not single-lined",
original: """
def test do
[
1,
2,
3
]
end
"""
end
end

0 comments on commit 6c8eaa5

Please sign in to comment.