-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Description
Environment
- Elixir & Erlang/OTP versions (elixir --version):
Erlang/OTP 22 [erts-10.6.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]
Elixir 1.10.2 (compiled with Erlang/OTP 22)
- Operating system:
Linux Mint 19
Current behavior
I have a test that looks like this:
user_info = %{"id" => user.identifier, "name" => user.name}
assert notification["user"] == user_info
assert %{
"user" => ^user_info,
"subtitle" => "Doesn't match"
} = notificationThe first assertion passes, showing that the inspected user info indeed matches the value at the "user" key in the notification we're matching against. However, when I get a match failure on a different key in the map, the diff shows that the pinned variable doesn't match, which we've already seen that it does.
This behavior also happens with tuples when they're pinned, but doesn't happen for integers, strings or lists.
Expected behavior
I would expect only the "subtitle" key to show a diff as that doesn't match, while the "user" key does.
If for some reason we can't make this correct, we should at least not show the pinned variables an the value it's matching against in red since that false negative can be quite confusing.
