Merge pull request #252 from foucist/master

Mismatch on koan description and assertion in 07_keyword_lists
This commit is contained in:
Uku Taht
2020-08-18 10:28:07 +03:00
committed by GitHub
3 changed files with 4 additions and 5 deletions

View File

@@ -17,9 +17,8 @@ defmodule KeywordLists do
koan "You could access the values of repeating key" do
kw_list = [foo: "bar", foo1: "bar1", foo: "baz"]
values = Keyword.get_values(kw_list, :foo)
assert List.last(values) == ___
assert Keyword.get_values(kw_list, :foo) == [___, ___]
end
koan "Keyword lists are just special syntax for lists of two-element tuples" do

View File

@@ -43,12 +43,12 @@ defmodule Structs do
end
koan "Use the put_in macro to replace a nested value" do
airline = %Airline{plane: %Plane{maker: :boeing}}
airline = %Airline{}
assert put_in(airline.plane.maker, :airbus) == ___
end
koan "Use the update_in macro to modify a nested value" do
airline = %Airline{plane: %Plane{maker: :boeing, passengers: 200}}
airline = %Airline{plane: %Plane{passengers: 200}}
assert update_in(airline.plane.passengers, fn x -> x + 2 end) == ___
end

View File

@@ -6,7 +6,7 @@ defmodule KeywordListsTests do
answers = [
"bar",
"bar",
"baz",
{:multiple, ["bar", "baz"]},
{:multiple, [:foo, "bar"]},
"foo"
]