简体   繁体   English

钢筋编译单元错误

[英]rebar compile eunit error

I user rebar to make a eunit test with command "rebar compile eunit",but get a error info: 我使用命令“ rebar compile eunit”使用rebar进行eunit测试,但收到错误信息:

==> 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 PS:我的英语不好,请原谅我

myapp_app.erl like this: myapp_app.erl像这样:

-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 它来自这里: https : //github.com/rebar/rebar/wiki/入门

I follow the step,but got the error! 我按照步骤执行,但出现错误!

My erlang version is R15B03 我的erlang版本是R15B03

os: OS X Lion 操作系统:OS X Lion

Make sure you include eunit in the following way: 确保以以下方式包括eunit:

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

Needless to say, make sure you installed eunit at all. 不用说,请确保已安装eunit。 So far I remember, it may be not installed by default in some Ubuntu versions, for instance. 到目前为止,我还记得,例如在某些Ubuntu版本中可能未默认安装它。

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. " (ASCII 34)代替 ,后者是unicode。

So change 所以改变

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

to

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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