Add example of lists not support partial match
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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!"]},
|
||||
|
||||
Reference in New Issue
Block a user