Running Elixir tests is usually just a matter of running mix test in your project’s directory. If you need to test only a single file, Elixir makes it just as easy. Most of the exercises we’ve done so far have been single Elixir files, outside of a mix project. Let’s see how easy it is to test them by setting up a test suite for the while macro we built in Adding a while Loop to Elixir.
First things first: we need to create a test file. Launch your editor and create a while_test.exs file with the following code. Be sure to save it in the same directory as your while.exs file from the previous exercise.
defmodule WhileTest do ...