簡體   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