Skip to content

Instantly share code, notes, and snippets.

@urfolomeus
Created December 23, 2018 20:02
Show Gist options
  • Select an option

  • Save urfolomeus/447876972c106246f91299ec18ffd328 to your computer and use it in GitHub Desktop.

Select an option

Save urfolomeus/447876972c106246f91299ec18ffd328 to your computer and use it in GitHub Desktop.
defmodule MySum do
def sum(x, y), do: x + y
end
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
@urfolomeus

Copy link
Copy Markdown
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment