If I run the tests with the code in bad.ex
, I get the following:
warning: variable expected_song is unused
test/channels/collusion_channel_test.exs:16
If I use good.ex
, it works. (naming!)
This is a macro that's doing a match behind the scenes. If I am not careful to write a test that fails first, I'll think this works when it doesn't because it binds whatever I pass. For instance, if I change the test such that expected_song = %{}
, which is not what the channel sends me, it will still pass without the hat obviously (though it does throw a warning)
This is super weird to me.