Add example of lists not support partial match

This commit is contained in:
Jay Hayes
2016-05-02 12:17:31 -05:00
parent 12ce3ba2d3
commit 944f932ec5
2 changed files with 7 additions and 0 deletions

View File

@@ -55,6 +55,12 @@ defmodule PatternMatching do
assert make == ___
end
koan "Lists must match exactly" do
assert_raise ___, fn ->
[a, b] = [1,2,3]
end
end
koan "The pattern can make assertions about what it expects" do
assert match?([1, _second, _third], ___)
end

View File

@@ -13,6 +13,7 @@ defmodule PatternsTests do
3,
"eggs, milk",
"Honda",
MatchError,
[1,2,3],
{:multiple, ["Meow", "Woof", "Eh?"]},
{:multiple, ["Mickey", "Donald", "I need a name!"]},