erlang宏扩展错误

时间:2015-09-08 13:31:54

标签: macros erlang

macro模块:

-module(macro).

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

-define(EXPAND(_T), ??_T).

macro_test() ->
    ?assertEqual("Test", ?EXPAND(Test)),
    ?assertEqual("Test.test", ?EXPAND(Test.test)).

结果是:

6> c(macro).         
{ok,macro}
7> eunit:test(macro).
macro: macro_test (module 'macro')...*failed*
in function macro:'-macro_test/0-fun-1-'/1 (macro.erl, line 9)
**error:{assertEqual_failed,[{module,macro},
                     {line,9},
                     {expression,"? EXPAND ( Test . test )"},
                     {expected,"Test.test"},
                     {value,"Test . test"}]}


=======================================================
  Failed: 1.  Skipped: 0.  Passed: 0.
error

我做错了什么或这是一个已知的错误?

TIA

0 个答案:

没有答案