Closed ostinelli closed 12 years ago
Using this module, and R15B01.
-module(example). -compile(export_all). get_config() -> file:consult("test.cfg"). -ifdef(TEST). -include_lib("eunit/include/eunit.hrl"). get_config_test_() -> meck:new(file, [unstick, passthrough]), meck:expect(file, consult, fun(Filename) -> ok end), ?_assertEqual(ok, get_config()), ?_assert(meck:validate(file)), meck:unload(file). -endif.
file_meck crashes when running the tests:
1> c(example, [{d, 'TEST'}]). example.erl:19: Warning: variable 'Filename' is unused example.erl:20: Warning: a term is constructed, but never used example.erl:21: Warning: a term is constructed, but never used {ok,example} 2> example:test(). undefined *** test generator failed *** ::{not_mocked,file} ======================================================= Failed: 0. Skipped: 0. Passed: 0. One or more tests were cancelled. error 11> =ERROR REPORT==== 22-Jul-2012::19:05:31 === ** Generic server file_meck terminating ** Last message in was {expect,consult,#Fun<example.0.68874524>} ** When Server state == {state,file, {dict,63,16,16,8,80,48, {[],[],[],[],[],[],[],[],[],[],[],[],[], [],[],[]}, {{[[{pid2name,1}|passthrough], [{altname,1}|passthrough], [{read_file,1}|passthrough], [{read_line,1}|passthrough], [{truncate,1}|passthrough], [{eval,2}|passthrough], [{path_eval,2}|passthrough], [{delete,1}|passthrough], [{close,1}|passthrough]], [[{pread,3}|passthrough], [{ipread_s32bu_p32bu_int,3}| passthrough], [{path_script,3}|passthrough], [{copy_opened,3}|passthrough]], [[{write_file,3}|passthrough], [{pwrite,3}|passthrough], [{ipread_s32bu_p32bu,3}|passthrough], [{change_time,3}|passthrough], [{position,2}|passthrough], [{open,2}|passthrough]], [[{read_file_info,2}|passthrough], [{read_link_info,2}|passthrough], [{write_file_info,2}|passthrough], [{raw_write_file_info,2}|passthrough]], [[{change_group,2}|passthrough], [{sendfile,5}|passthrough]], [], [[{read_link,1}|passthrough], [{copy,3}|passthrough], [{change_owner,2}|passthrough], [{get_cwd,0}|passthrough]], [[{eval,1}|passthrough]], [[{pread,2}|passthrough], [{path_consult,2}|passthrough], [{script,2}|passthrough], [{path_script,2}|passthrough], [{read,2}|passthrough]], [[{rename,2}|passthrough], [{write_file,2}|passthrough], [{pwrite,2}|passthrough], [{path_eval,3}|passthrough], [{change_mode,2}|passthrough], [{change_time,2}|passthrough], [{sendfile,2}|passthrough], [{write,2}|passthrough]], [[{read_link_info,1}|passthrough], [{raw_read_file_info,1}|passthrough], [{read_file_info,1}|passthrough]], [[{advise,4}|passthrough], [{path_open,3}|passthrough]], [[{write_file_info,3}|passthrough]], [[{make_dir,1}|passthrough], [{del_dir,1}|passthrough], [{copy,2}|passthrough], [{list_dir,1}|passthrough], [{format_error,1}|passthrough]], [[{datasync,1}|passthrough], [{sync,1}|passthrough]], [[{set_cwd,1}|passthrough], [{make_link,2}|passthrough], [{make_symlink,2}|passthrough], [{script,1}|passthrough], [{change_owner,3}|passthrough], [{get_cwd,1}|passthrough], [{consult,1}|passthrough]]}}}, true,[], {false,no_passthrough_cover}, true} ** Reason for termination == ** {compile_forms, {error, [{[], [{none,compile, {crash,beam_asm, {{not_mocked,file}, [{meck,gen_server,3,[{file,"src/meck.erl"},{line,452}]}, {meck,exec,5,[{file,"src/meck.erl"},{line,417}]}, {filename,absname,1,[{file,"filename.erl"},{line,67}]}, {compile,beam_asm,1, [{file,"compile.erl"},{line,1241}]}, {compile,'-internal_comp/4-anonymous-1-',2, [{file,"compile.erl"},{line,269}]}, {compile,fold_comp,3, [{file,"compile.erl"},{line,287}]}, {compile,internal_comp,4, [{file,"compile.erl"},{line,271}]}, {compile,internal,3, [{file,"compile.erl"},{line,246}]}]}}}]}], []}}
I'm closing this since it is a duplicate of #36.
Using this module, and R15B01.
file_meck crashes when running the tests: