Created
December 23, 2018 20:02
-
-
Save urfolomeus/447876972c106246f91299ec18ffd328 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule MySum do | |
def sum(x, y), do: x + y | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ExUnit.start() | |
defmodule MySumTest do | |
use ExUnit.Case, async: true | |
Code.require_file("./my_sum.exs") | |
test "it gives 3 when inputs are 1 and 2" do | |
assert(MySum.sum(1, 2) == 3) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can run this example by putting both files in the same folder and then on the command line, whilst in that folder, running
elixir my_sum_test.exs
.