Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Behaviour not getting picked up #21

Open
ashton314 opened this issue Dec 4, 2024 · 0 comments
Open

Behaviour not getting picked up #21

ashton314 opened this issue Dec 4, 2024 · 0 comments

Comments

@ashton314
Copy link
Member

Consider this code from chorex_test.exs at 6c47aeb:

defmodule TestChor1Unsplatting do
  defchor [Buyer1us, Seller1us] do
    def run() do
      Buyer1us.get_book_title() ~> Seller1us.(b)
      Seller1us.get_price("book:" <> b) ~> Buyer1us.(p)
      Seller1us.order_book(b)
      Buyer1us.(p + 2)
    end
  end
end

defmodule MyBuyer1Unsplatting do
  use TestChor1Unsplatting.Chorex, :buyer1us

  def get_book_title(), do: "Das Glasperlenspiel"
end

defmodule MySeller1Unsplatting do
  use TestChor1Unsplatting.Chorex, :seller1us

  def get_price("book:Das Glasperlenspiel"), do: 40
  def get_price("Das Glasperlenspiel"), do: 39
  def get_price(_), do: 0
end

test "choreography unsplat runs" do
  Chorex.start(TestChor1Unsplatting.Chorex,
               %{Buyer1us => MyBuyer1Unsplatting,
               Seller1us => MySeller1Unsplatting},
               [])
  assert_receive {:chorex_return, Buyer1us, 42}
  assert_receive {:chorex_return, Seller1us, 19}
end

I should be getting a compile time error that order_book is not implemented as a callback, but instead I'm getting a runtime explosion.

Maybe it's because it's an .exs file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant