-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix non-existing atom exception when accidentally matching on map lit…
…eral This fixes a crash that looks like this: ``` ** (ArgumentError) errors were found at the given arguments: * 1st argument: not an already existing atom ``` ...which was previously occurring when you used the literal map matcher on a map with arbitrary string keys that don't have a corresponding atom defined. For me, this occurred when I forgot to wrap my map matcher in a `superset/1`. So, for instance, what I *meant* was: ```elixir assert %{"foo" => "bar", "baz" => "bop"} ~> superset(%{"foo" => "bar"}) ``` ...but what I accidentally wrote was just: ```elixir assert %{"foo" => "bar", "baz" => "bop"} ~> %{"foo" => "bar"} ``` Because the error was so generic, this was pretty difficult to debug. With this change applied, though, you now get a nice "Unexpected key" error.
- Loading branch information
Showing
3 changed files
with
26 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters