Skip to content

Commit

Permalink
Add other lessons that don't work with answer system
Browse files Browse the repository at this point in the history
  • Loading branch information
iamvery committed May 5, 2016
1 parent c1c3b90 commit 8211f89
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/koans/03_atoms.ex
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,22 @@ defmodule Atoms do
assert list[:name] == ___
end

#koan "Only atom keys may be accessed with dot syntax" do
# map = %{name: "Jay"}
# assert map.name == ___

# map = %{"name" => "Jay"}
# assert_raise KeyError, fn -> ___ end
# assert map["name"] == ___
#end

#koan "Dot syntax is stricter than access with brackets" do
# map = %{name: "Jay"}

# assert map[:age] == ___
# assert_raise KeyError, fn -> ___ end
#end

koan "It is surprising to find out that booleans are atoms" do
assert is_atom(true) == ___
assert is_atom(false) == ___
Expand Down
2 changes: 2 additions & 0 deletions test/koans/atoms_koans_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ defmodule AtomsTests do
:human,
{:multiple, [:atomized, "stringified"]},
{:multiple, ["Jay", "Jay"]},
#{:multiple, ["Jay", quote(do: map.name), "Jay"]},
#{:multiple, [nil, quote(do: map.age)]},
{:multiple, [true, true, true, false]},
{:multiple, [true, String, "HELLO"]},
{:multiple, [true, [1,2,3]]},
Expand Down

0 comments on commit 8211f89

Please sign in to comment.