Git Product home page Git Product logo

Comments (7)

briankung avatar briankung commented on June 2, 2024 1

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.

briankung avatar briankung commented on June 2, 2024 1

Wow, I had a question mark in there this whole time? πŸ€¦β€β™‚οΈ thanks for the hint and the PR!

from elixir-koans.

briankung avatar briankung commented on June 2, 2024

This is happening with the next koan, too 😭 I wonder if there is some sort of configuration I'm missing. The spawned process receives a message, but it doesn't match against the PID for some reason. I even tried using 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.

iamvery avatar iamvery commented on June 2, 2024

Hey Brian, very late reply here πŸ˜… . Can you try this again? Some changes were made in #271 that may address the problem you were seeing.

from elixir-koans.

briankung avatar briankung commented on June 2, 2024

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.

iamvery avatar iamvery commented on June 2, 2024

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.

iamvery avatar iamvery commented on June 2, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.