Skip to content

Commit

Permalink
Add assertion to catch idempotency bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
novaugust committed Dec 6, 2023
1 parent 2ef4c30 commit 2e4254c
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion test/support/style_case.ex
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,22 @@ defmodule Styler.StyleCase do
IO.puts("========================\n")
end

assert styled == expected
assert expected == styled
{_, restyled, _} = style(styled)

assert restyled == styled, """
expected styling to be idempotent, but a second pass resulted in more changes.
first pass:
----
#{styled}
----
second pass:
----
#{restyled}
----
"""
end
end

Expand Down

0 comments on commit 2e4254c

Please sign in to comment.