Skip to content

Conversation

eksperimental
Copy link
Contributor

The pinned variables were returned in a reversed alphabetical order.

 test/ex_unit_pinned_variables_order_test.exs:23
 match (=) failed
 The following variables were pinned:
   var_d = "four"
   var_c = "three"
   var_b = "two"
   var_a = "one"
 code:  assert %{a: ^var_d, b: ^var_c, c: ^var_b, d: ^var_a} = build(var_a, var_b, var_c, var_d)
 left:  %{a: ^var_d, b: ^var_c, c: ^var_b, d: ^var_a}
 right: %{a: "one", b: "two", c: "three", d: "four"}
 stacktrace:
   test/ex_unit_pinned_variables_order_test.exs:29: (test)

This fix sorts them alphabetically.

This bug was introduced in 884e933 when the pinned vars were now accumulated in a map (instead of a list), therefore no longer the need to reverse the results.

A repo replicating the issue can be found here:

The pinned variables were returned in a reversed alphabetical
order.

     test/ex_unit_pinned_variables_order_test.exs:23
     match (=) failed
     The following variables were pinned:
       var_d = "four"
       var_c = "three"
       var_b = "two"
       var_a = "one"
     code:  assert %{a: ^var_d, b: ^var_c, c: ^var_b, d: ^var_a} = build(var_a, var_b, var_c, var_d)
     left:  %{a: ^var_d, b: ^var_c, c: ^var_b, d: ^var_a}
     right: %{a: "one", b: "two", c: "three", d: "four"}
     stacktrace:
       test/ex_unit_pinned_variables_order_test.exs:29: (test)

This fix sorts them alphabetically.

This bug was introduced in 884e933 when the pinned vars were now accumulated in a map (instead
of a list), therefore no longer the need to reverse the results.

A repo replicating the issue can be found here:
- https://github.com/eksperimental-debug/elixir_debug/tree/ex-unit-pinned-variables-order
- https://github.com/eksperimental-debug/elixir_debug/blob/ex-unit-pinned-variables-order/ex_unit_pinned_variables_order/test/ex_unit_pinned_variables_order_test.exs
@eksperimental eksperimental force-pushed the fix/ex-unit-pinned-variables-order branch from c9f52d2 to 16c2654 Compare August 26, 2025 13:36
Co-authored-by: José Valim <jose.valim@gmail.com>
@josevalim josevalim merged commit 927f91c into elixir-lang:main Aug 27, 2025
23 of 26 checks passed
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

@eksperimental eksperimental deleted the fix/ex-unit-pinned-variables-order branch August 27, 2025 07:12
josevalim pushed a commit that referenced this pull request Aug 31, 2025
The pinned variables were returned in a random order (often reversed):

     test/ex_unit_pinned_variables_order_test.exs:23
     match (=) failed
     The following variables were pinned:
       var_d = "four"
       var_c = "three"
       var_b = "two"
       var_a = "one"
     code:  assert %{a: ^var_d, b: ^var_c, c: ^var_b, d: ^var_a} = build(var_a, var_b, var_c, var_d)
     left:  %{a: ^var_d, b: ^var_c, c: ^var_b, d: ^var_a}
     right: %{a: "one", b: "two", c: "three", d: "four"}
     stacktrace:
       test/ex_unit_pinned_variables_order_test.exs:29: (test)

This fix sorts them alphabetically.

This bug was introduced in 884e933 when the pinned vars were now accumulated in a map (instead
of a list).

A repo replicating the issue can be found here:
- https://github.com/eksperimental-debug/elixir_debug/tree/ex-unit-pinned-variables-order
- https://github.com/eksperimental-debug/elixir_debug/blob/ex-unit-pinned-variables-order/ex_unit_pinned_variables_order/test/ex_unit_pinned_variables_order_test.exs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants