简体   繁体   中英

rebar compile eunit error

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

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.

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").

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM