Question

I user rebar to make a eunit test with command "rebar compile eunit",but get a error info:

==> myapp (compile)

==> myapp (eunit)

src/myapp_app.erl:8: badly formed 'include_lib'

src/myapp_app.erl:26: undefined macro 'assertNot/1'

ERROR: eunit failed while processing /Users/Dao/ErlProject/myapp: rebar_abort

I really don't know how this mean,who can tell me why?

PS:my english is poor,please forgive me

myapp_app.erl like this:

-ifdef(TEST).

-include_lib(“eunit/include/eunit.hrl”).

-endif.

........

-ifdef(TEST).

 simple_test() ->

  ok = application:start(myapp),

  ?assertNot(undefined == whereis(myapp_sup)).

-endif.

and It's came from here:https://github.com/rebar/rebar/wiki/Getting-started

I follow the step,but got the error!

My erlang version is R15B03

os: OS X Lion

Was it helpful?

Solution

Based on the code you've presented, I believe the problem has to do with the doublequotes you're using. Right now, you are using some kind of slanted quotes, which, if I copy and paste it and use that same definition myself in a test module, it generates the same error.

You want to make sure for your doublequotes that you use "normal" ones:

" (ASCII 34) instead of , which is unicode.

So change

-include_lib(“eunit/include/eunit.hrl”).

to

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

OTHER TIPS

Make sure you include eunit in the following way:

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

Needless to say, make sure you installed eunit at all. So far I remember, it may be not installed by default in some Ubuntu versions, for instance.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top