[erlang-questions] silly rebar eunit TEST macro problem

Angel Alvarez (GMAIL) <>
Tue Apr 29 13:26:57 CEST 2014


Hi Guys,

Ive been away for a while and back to erlang programming.

Currently I'm setting up tests for a project but I I can't make rebar run my tests… 

There is a module where I have:


-module(udp_driver_srv).

-ifdef(TEST).
-compile(export_all).
-else.
%% ------------------------------------------------------------------
%% API Function Exports
%% ------------------------------------------------------------------

-export([start_link/1, option_specs/0, check_valid_port/1]).

%% ------------------------------------------------------------------
%% gen_server Function Exports
%% ------------------------------------------------------------------

-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
         terminate/2, code_change/3]).

-endif.


later I have a few tests (one right now)

-ifdef(TEST).

-include_lib("eunit/include/eunit.hrl").

pool_new_void_test() ->
  Pool = pool_new(),
  ?assertEqual(empty,Pool).

-endif.


But it doesn't run when I run  "rebar eunit":

…
...
Compiled src/servers/middleman_srv.erl
Compiled src/dhcp_server.erl
Compiled src/script_utils/getopt.erl
======================== EUnit ========================
module 'udp_driver_srv'
module 'network_sup'
module 'module_tools'
module 'middleman_sup'
module 'middleman_srv'
module 'getoptex'
module 'getopt'
module 'fsm_sup'
module 'ets_master_srv'
module 'dora_fsm'
module 'dhcp_server_sup'
module 'dhcp_server_app'
module 'dhcp_server'
module 'dhcp_console_srv'
module 'addr_pool_sup'
module 'addr_pool_srv'
  There were no tests to run.

After trying to figure out what's going on, I guess the TEST macro isn't honored by rebar eunit anymore or
I'm missing something very stupid out. I recall from other setups that this used to work like a charm but…

¿Anyone can give a clue about this?

Thanks in advance


Angel Alvarez (GMAIL)







More information about the erlang-questions mailing list