繁体   English   中英

钢筋编译单元错误

[英]rebar compile eunit error

我使用命令“ 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

我真的不知道这是什么意思,谁能告诉我为什么?

PS:我的英语不好,请原谅我

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.

它来自这里: https : //github.com/rebar/rebar/wiki/入门

我按照步骤执行,但出现错误!

我的erlang版本是R15B03

操作系统:OS X Lion

确保以以下方式包括eunit:

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

不用说,请确保已安装eunit。 到目前为止,我还记得,例如在某些Ubuntu版本中可能未默认安装它。

根据您提供的代码,我认为问题与您使用的双引号有关。 现在,您正在使用某种倾斜的引号,如果我将其复制并粘贴并在测试模块中自己使用相同的定义,则会产生相同的错误。

您要确保为双引号使用“普通”的双引号:

" (ASCII 34)代替 ,后者是unicode。

所以改变

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

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

暂无
暂无

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

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