0

使用 Erlang R16B02、riakc 2.0.0 和 meck 0.82:

当试图在我的单元测试中模拟 riakc_pb_socket 时,它会爆炸。这是我得到的:

> erl -pa ebin deps/*/ebin
Erlang R16B02 (erts-5.10.3) [source-b44b726] [64-bit] [smp:2:2] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V5.10.3  (abort with ^G)
1> meck:new(riakc_pb_socket).
** exception exit: {compile_forms,{error,[{[],
                                           [{75,erl_lint,{bad_deprecated,{get_index,'_'}}}]}],
                                         [{[],[{75,erl_lint,{undefined_behaviour,[gen_server]}}]}]}}
2>

我发现如果我在 riakc_pb_socket.erl 中评论这一行并重新编译 - 问题就会消失。有更好的解决方案吗?

-deprecated({get_index,'_', eventually}). 

所以后来……

> erl -pa ebin deps/*/ebin
Erlang R16B02 (erts-5.10.3) [source-b44b726] [64-bit] [smp:2:2] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V5.10.3  (abort with ^G)
1> meck:new(riakc_pb_socket).
ok
2> 

> erl -pa ebin deps/*/ebin
Erlang R16B02 (erts-5.10.3) [source-b44b726] [64-bit] [smp:2:2] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V5.10.3  (abort with ^G)
1> code:which(riakc_pb_socket).
"deps/riakc/ebin/riakc_pb_socket.beam"
2> 

4

0 回答 0