Cannot start remote function inside Unit test

im trying to install some unit tests with Elixir but having run into this error below. What am I doing wrong?

cannot invoke remote function PropertyManager.Database.get/0 inside match 

Here is my code:

property_manager_test.exs

 defmodule PropertyManagerTest do use ExUnit.Case test "the truth" do assert 1 + 1 == 2 end test "get value from db" do assert PropertyManager.Database.get() = "test this" end end 

database.ex

 defmodule PropertyManager.Database do def get do "test this" end end 
+5
source share
1 answer

Try == instead of =

What you do in your code is a pattern match, which means that it will try to match the right side with the pattern on the left side. The template cannot contain function calls, which is probably the cause of your error.

+9
source

Source: https://habr.com/ru/post/1209485/


All Articles