当我使用io:format / 2打印一些信息时,我发现有点括号之间的内容会被静静地丢弃。
请参阅以下示例: 1)测试套件
-module(ioformat_SUITE).
-compile(export_all).
all() ->
[test_ioformat].
test_ioformat(_) ->
Expected =
[
<<"NoMethod <ATestMessage>\r\n">>
],
io:format("ExpectedASCII:~n~p~n",[Expected]),
io:format("ExpectedBINARY:~n~w~n",[Expected]).
2)运行测试套件
ct_run -suite ioformat_SUITE
3)检查测试用例的日志
ExpectedASCII:
[&lt;“NoMethod \ r \ n”&gt;&gt;]
ExpectedBINARY: 并[d&LT; 78,111,77,101,116,104,111,100,32,60,65,84,101,115,116,77,101,115,115,97,103,101,62,13,10&GT;&GT;]
===截至2012-09-03 08:48:04
4)我们可以看到日志中没有“ATestMessage”。这个内容被common_test静静地扔掉了。
这是common_test中的错误吗?这有什么解决方法吗?
谢谢!
答案 0 :(得分:3)
我很确定Common Test没有吃你的信息。 如果您要在浏览器中打开日志,请查看页面源代码。我打赌你的HTML标签就在那里,根本不是由浏览器呈现的。 怎么样:
Expected =
[
<<"NoMethod <ATestMessage>\r\n">>
],