Skip to content

Use string.inspect on Literal dynamic value instead of a `"literal" string#70

Merged
lpil merged 1 commit into
lpil:mainfrom
quentin-bettoum:print_literal_values
Jun 7, 2026
Merged

Use string.inspect on Literal dynamic value instead of a `"literal" string#70
lpil merged 1 commit into
lpil:mainfrom
quentin-bettoum:print_literal_values

Conversation

@quentin-bettoum

@quentin-bettoum quentin-bettoum commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

In some cases, the gleam test command don't print the right result when the assertion fails:

 code: assert void_html_sample() == "<some_tag>"
 left: "<some_tag/>"
right: literal
 info: Assertion failed.

Is there a specific reason for this literal string?
If not, this change prints the dynamic value instead, which I feel make it easier to see the difference:

 code: assert void_html_sample() == "<some_tag>"
 left: "<some_tag/>"
right: "<some_tag>"
 info: Assertion failed.

It would be even nicer with diff coloring, like in Elixir, but that's a level of complexity I'm not ready to take on for now 🙂

@lpil lpil left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thank you!

@lpil lpil merged commit e4e0a76 into lpil:main Jun 7, 2026
1 check passed
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.

2 participants