Comments (7)
Thanks for coming back to notify me! I've since moved on, but I'll try to run this when I get a chance.
from elixir-koans.
Wow, I had a question mark in there this whole time?
from elixir-koans.
This is happening with the next koan, too when is_pid(sender)
on the match arm (as recommended here), but it still failed. When I use the match arm any -> IO.puts(any)
in iex
it prints out the {:hello, #PID<0.105.0>}
. Actually, this whole thing works as expected in iex
, just not in the test framework.
from elixir-koans.
Hey Brian, very late reply here
from elixir-koans.
Hi @iamvery unfortunately no, it still doesn't seem to work. I don't know how to run a single koan, but I replaced my 01_equalities.ex
file with these contents and it still doesn't pass:
defmodule Equalities do
use Koans
@intro """
Welcome to the Elixir koans.
Let these be your first humble steps towards learning a new language.
The path laid in front of you is one of many.
"""
koan "A common pattern is to include the sender in the message, so that it can reply" do
self_pid = self()
greeter = fn ->
receive do
_anything -> send(self_pid, :how_are_you?)
end
end
pid = spawn(greeter)
send(pid, {:hello, self()})
assert_receive :how_are_you
end
end
And I get this output:
Welcome to the Elixir koans.
Let these be your first humble steps towards learning a new language.
The path laid in front of you is one of many.
Now meditate upon Equalities
| | 0 of 203
----------------------------------------
A common pattern is to include the sender in the message, so that it can reply
Assertion failed in lib/koans/01_equalities.ex:23
assert_receive :how_are_you
left: :how_are_you
right: :ex_unit_no_meaningful_value
Now, I haven't touched the Koans in a while, so my process was to git pull
then mix deps.get
then finally mix meditate
. Not sure what it could be. If you have any ideas for debugging, I'd be happy to try them out.
from elixir-koans.
Ah hah! Thanks for writing back, I see the problem with your solution now, and the error message definitely leaves something to be desired. The value sent back is the atom :how_are_you?
(note: the trailing "question mark" is included). That should be enough to get the example passing.
I don't know how to run a single koan
You can run a single Koan file by its module name like mix meditate --koan=Processes
, but it will still run them from the top of that file. From there, you could comment out the first few to target specific example.
I hope this helps!
from elixir-koans.
I see, it's because the value given to assert_receive
is used for a match. Since the pattern match fails, you get a pretty crummy error message. I'll add a failure message to the call which may help clear it up. PR incoming
from elixir-koans.
Related Issues (20)
- Webversion of elixir koans HOT 2
- Keyword lists / assert_raise ArgumentError HOT 13
- 04_atoms.ex has unclear expectations HOT 7
- Autoreload doesnβt work with unicode paths HOT 3
- watcher does not work as expected HOT 9
- Range.range?/1 is deprecated HOT 3
- typo: divison -> division HOT 1
- Test duplication on GenServer koans HOT 1
- warning: the Collectable protocol is deprecated for non-empty lists HOT 3
- FunctionClauseError when starting newly cloned elixir-koans HOT 4
- help with koan "15 processes: Waiting for a message can get boring" HOT 1
- Question on Patern Matching HOT 6
- Koans might be more educational when inverted HOT 1
- Koan about rounding pitfalls
- Should the koans prefer `in/2` over `member?/2`? HOT 1
- Fix failing tests & consider adding CI
- Trying to run mix deps.get throws an error for OTP 25 HOT 1
- weird answer for process koan about message queue HOT 2
- Domain registration HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elixir-koans.