Commit Graph

562 Commits

Author SHA1 Message Date
Jay Hayes
1f1112c888 Add koan illustrating that a process is referenced by a pid 2016-05-04 15:05:19 -05:00
Uku Taht
b39f951fcc Merge pull request #101 from elixirkoans/multiple-answers-for-assert-receive
Allow multiple answers in pinned context
2016-05-04 17:58:44 +01:00
Uku Taht
bc8f98d5d9 Merge pull request #100 from iamvery/tweak-maps-koan
Replace pipeline with composed function in maps koan
2016-05-04 15:49:05 +01:00
Jay Hayes
e2468b92cc Avoid keys order issue by using Maps.has_key?/2 2016-05-04 09:28:49 -05:00
Jay Hayes
f93e29cc8c Remove "keys and values" example 2016-05-04 09:28:35 -05:00
Uku Taht
a9ee9404ad Destructure answers in test function 2016-05-04 10:48:14 +01:00
Uku Taht
48b593be8e Merge pull request #99 from iamvery/tweak-enum-koan
Tweak enum koan
2016-05-04 10:18:08 +01:00
Uku Taht
43d4ac5360 Merge pull request #92 from iamvery/update-koans
Update various koans
2016-05-04 09:49:48 +01:00
Uku Taht
cda9b3526c Merge pull request #93 from iamvery/assert-receive-does-not-work
Problem with assert_receive in koans
2016-05-04 09:48:55 +01:00
Jay Hayes
c39916df2e Replace pipeline with composed function
At this point, the learner hasn't seen functions, the Enum module, or
the pipe operator, so it feels like a little much to add that here. The
reason it's needed is that the order of keys/1 and values/1 is reverse
of how it's defined. This is due to an implementation detail in Erlang's
maps. We /could/ use this as a learning opportunity rather than sorting
them, but I'm not sure what could be said about that...
2016-05-03 19:31:07 -05:00
Jay Hayes
19998b452c Add another match to illustrate that only the first is found 2016-05-03 19:22:16 -05:00
Jay Hayes
4017cfcd72 Change test data to illustrate that they /all/ must match 2016-05-03 19:21:51 -05:00
Jay Hayes
b184de5817 Remove parens from self
In my experience, the parens in this case are not idiomatic.
2016-05-03 19:11:28 -05:00
Jay Hayes
74b99676e7 Add example of anonymous function as argument 2016-05-03 19:08:51 -05:00
Jay Hayes
a808d275db Reword function pattern matching example 2016-05-03 19:08:51 -05:00
Jay Hayes
8311362f19 Reword function with default arg example 2016-05-03 19:08:51 -05:00
Jay Hayes
64d6e72b46 Add example of matching map with struct 2016-05-03 19:08:51 -05:00
Jay Hayes
8bcd7d2c94 Reword function pattern matching example 2016-05-03 19:08:51 -05:00
Jay Hayes
944f932ec5 Add example of lists not support partial match 2016-05-03 19:08:51 -05:00
Jay Hayes
12ce3ba2d3 Reword maps matching example 2016-05-03 19:08:51 -05:00
Jay Hayes
b577a24753 Extract initial example of binding before showing rebinding 2016-05-03 19:08:51 -05:00
Jay Hayes
4fda4ab9ff Reword pinning example 2016-05-03 19:08:51 -05:00
Uku Taht
cb47a17da9 Merge pull request #95 from iamvery/process-tests
Restructure/simplify process koans
2016-05-03 22:41:44 +01:00
Uku Taht
228c5f6879 Merge pull request #97 from elixirkoans/fix-version
Ensure elixir version is at least 1.2.1
2016-05-03 21:36:32 +01:00
Uku Taht
b7161fdc90 Ensure elixir version is at least 1.2.1 2016-05-03 19:06:29 +01:00
Jay Hayes
b2458bb472 Consistent one-liner for receive-blocked processes 2016-05-03 08:23:57 -05:00
Jay Hayes
1611483206 Reword some more examples 2016-05-03 08:23:57 -05:00
Jay Hayes
cc47f7c9c6 Simplify cases 2016-05-03 08:23:56 -05:00
Jay Hayes
71dfd882c6 Tweak wording 2016-05-03 08:23:23 -05:00
Jay Hayes
8ea68548fe Simplify example 2016-05-03 08:23:23 -05:00
Jay Hayes
2d7982e9a3 Remove indirection of wait/0 2016-05-03 08:23:23 -05:00
Jay Hayes
b955a4db64 Remove unneeded case 2016-05-03 08:23:23 -05:00
Jay Hayes
6772308e9a Add a little more context to example description 2016-05-03 08:23:23 -05:00
Jay Hayes
dacaf4c0b1 Actually illustrate use of receive function 2016-05-03 08:23:22 -05:00
Jay Hayes
bef1cf5028 Add new test illustrating spawning processes 2016-05-03 08:23:00 -05:00
Jay Hayes
c7c2fbcdff Auto-pin variables when replacing blanks in assert_receive 2016-05-02 20:45:03 -05:00
Jay Hayes
1b99ab0650 Pin missing values in assert_receive
Turns out the way assert_receive is implemented, the expression give the
macro is used literally as the match for the expanded receive call.
2016-05-02 16:12:03 -05:00
Jay Hayes
adabb403ea Fix typo in answers
This isn't failing due to an apparently problem with assert_receive in
the koans. Not quite sure yet why that macro isn't working.
2016-05-02 15:11:30 -05:00
Uku Taht
3892c0477e Merge pull request #89 from iamvery/assert-koan-test-results
Assert koan test results
2016-04-28 11:06:24 +01:00
Uku Taht
b422920387 Merge pull request #90 from elixirkoans/cleanup-display
Cleanup display
2016-04-28 11:03:56 +01:00
Jay Hayes
1f4f82ea53 Add parens around Enum.each/2 2016-04-27 15:53:37 -05:00
Felipe Sere
a5c3d910a7 Use heredoc-style for longer blocks of text in Display 2016-04-27 21:12:13 +01:00
Felipe Sere
fb56540193 Remove the last exit from Display 2016-04-27 21:06:26 +01:00
Felipe Sere
b01727f9b8 Extract colours into their own little module 2016-04-27 21:04:31 +01:00
Jay Hayes
c621c1abaa Assert the results of all koans tests 2016-04-27 12:15:26 -05:00
Jay Hayes
39f09e5c30 Handle errors in tests functions as well
This allows failures to be passed back to the parent rather than the
koan process just dying and the parent stuck waiting for the result.
2016-04-27 12:14:25 -05:00
Uku Taht
527b5ea028 Merge pull request #77 from iamvery/exit-on-completion
Congratulate and exit when koans are complete
2016-04-27 10:27:44 +01:00
Jay Hayes
814d3db995 Refactor Tracker get/0 and summarize/0 2016-04-26 18:16:17 -05:00
Jay Hayes
93c41d6ced Move explicit exit out of display function 2016-04-26 18:10:16 -05:00
Jay Hayes
9b65177e17 Pin variable in match
This prevents accepting messages accidentally for another dying process.
2016-04-26 17:43:11 -05:00