I use Emacs and try to automate my testing workflow as much as possible. I configured it so that it works, but I need to manually compile the module under test or the module containing the tests before Erlang Shell recognizes my changes.
I have two files mymodule.erland mymodule_tests.erl. I would like to be able to:
- Add test case to mymodule_tests
- Save mymodule_tests
- Switch to Erlang Shell
- Run tests with a single line, for example,
eunit:test(mymodule)ormymodule_tests:test() - Before running Erlang tests, reload mymodule and mymodule_tests
I tried to write my own testing method, but it does not work.
-module (mytests).
-export([test/0]).
-import(mymodule).
-import(mymodule_tests).
-import(code).
test() ->
code:purge(mymodule),
code:delete(mymodule),
code:load_file(mymodule),
code:purge(mymodule_tests),
code:delete(mymodule_tests),
code:load_file(mymodule_tests),
mymodule_tests:test().
-compile(mymodule). mymodule_tests, , mymodule mymodule_tests, .
googled, . Erlang, , , . erlang reload module, .