Squash compiler warnings.
This commit is contained in:
@@ -52,7 +52,7 @@ defmodule Functions do
|
||||
end
|
||||
|
||||
def sum_up(thing) when is_list(thing), do: :entire_list
|
||||
def sum_up(thing), do: :single_thing
|
||||
def sum_up(_thing), do: :single_thing
|
||||
koan "You can 'guard' functions against their arguments" do
|
||||
assert sum_up([1,2,3]) == :entire_list
|
||||
assert sum_up(1) == :single_thing
|
||||
|
||||
@@ -53,8 +53,9 @@ defmodule Arithmetic do
|
||||
end
|
||||
|
||||
koan "it can not divide by zero" do
|
||||
div_by = fn(n) -> 1 / n end
|
||||
try do
|
||||
1 / 0.0
|
||||
div_by.(0)
|
||||
rescue
|
||||
ArithmeticError -> true
|
||||
end
|
||||
|
||||
@@ -6,7 +6,8 @@ defmodule Structs do
|
||||
end
|
||||
|
||||
koan "structs are defined and named after a module" do
|
||||
assert %Person{}
|
||||
person = %Person{}
|
||||
assert person == %Person{}
|
||||
end
|
||||
|
||||
koan "you can access the fields of a struct" do
|
||||
@@ -53,7 +54,6 @@ defmodule Structs do
|
||||
koan "are basically maps" do
|
||||
silvia = %Person{age: 22, name: "Silvia"}
|
||||
|
||||
assert is_map(silvia)
|
||||
assert Map.fetch!(silvia, :age) == 22
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user