Skip to content

Allows custom format width#8

Open
wingyplus wants to merge 1 commit into
DCzajkowski:masterfrom
wingyplus:custom-format-width
Open

Allows custom format width#8
wingyplus wants to merge 1 commit into
DCzajkowski:masterfrom
wingyplus:custom-format-width

Conversation

@wingyplus
Copy link
Copy Markdown

Hi,

Thank you for making this library. It help me and my team save testing time a lot. ❤️

I create this patch to custom format line width. The previous one is fixed to only 80.

Why is it matter

In my daily work, I have csv table like data structure (list of list) to test in unit test, columns quite a lot, and current snapshot format width make it hard to read (but it's better than asserting in unit test!).

Comparing width at 80 vs 500:

80

Screenshot 2566-09-15 at 10 26 19

500

Screenshot 2566-09-15 at 10 09 42

Make format width argument in `Inspect.Algreba.format` customizable
though `Config`.

Signed-off-by: Thanabodee Charoenpiriyakij <wingyminus@gmail.com>
Comment thread lib/snapshy.ex
|> Inspect.Algebra.to_doc(inspect_options())
|> Inspect.Algebra.group()
|> Inspect.Algebra.format(80)
|> Enum.join()
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also remove Enum.join since File.write can accept iodata. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant