diff options
author | Sverker Eriksson <[email protected]> | 2014-05-20 20:42:29 +0200 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2014-05-20 20:42:33 +0200 |
commit | d4d5b4375dae706edb6deda9faebc66000aa2019 (patch) | |
tree | 8bacb40163179f93af6e3a5a23563f89d4882078 /erts/emulator/test | |
parent | 23f73961cbd2d48b019214dcba243afb80034ce9 (diff) | |
parent | 0dbcbea0cf52672ef1cf051c3cd7640eb7ff728e (diff) | |
download | otp-d4d5b4375dae706edb6deda9faebc66000aa2019.tar.gz otp-d4d5b4375dae706edb6deda9faebc66000aa2019.tar.bz2 otp-d4d5b4375dae706edb6deda9faebc66000aa2019.zip |
Merge branch 'sverk/better-module-info'
OTP-11940
* sverk/better-module-info:
Remove obsolete 'imports' entry from module_info/1/2 functions
Add 'module' entry for module_info/0 function for completeness
Add 'md5' entry for module_info/0/1 functions.
Diffstat (limited to 'erts/emulator/test')
-rw-r--r-- | erts/emulator/test/module_info_SUITE.erl | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/erts/emulator/test/module_info_SUITE.erl b/erts/emulator/test/module_info_SUITE.erl index 8a63d9fe3e..f3986f0c4f 100644 --- a/erts/emulator/test/module_info_SUITE.erl +++ b/erts/emulator/test/module_info_SUITE.erl @@ -24,7 +24,7 @@ -export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, init_per_group/2,end_per_group/2, init_per_testcase/2,end_per_testcase/2, - exports/1,functions/1,native/1]). + exports/1,functions/1,native/1,info/1]). %%-compile(native). @@ -52,8 +52,8 @@ end_per_group(_GroupName, Config) -> Config. -modules() -> - [exports, functions, native]. +modules() -> + [exports, functions, native, info]. init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) -> Dog = ?t:timetrap(?t:minutes(3)), @@ -122,6 +122,22 @@ native_proj({Name,Arity,Addr}) -> native_filter(Set) -> sofs:no_elements(Set) =/= 1. +%% Test that the module info of this module is correct. Use +%% erlang:get_module_info(?MODULE) to avoid compiler optimization tricks. +info(Config) when is_list(Config) -> + Info = erlang:get_module_info(?MODULE), + All = all_exported(), + {ok,{?MODULE,MD5}} = beam_lib:md5(code:which(?MODULE)), + {module, ?MODULE} = lists:keyfind(module, 1, Info), + {md5, MD5} = lists:keyfind(md5, 1, Info), + {exports, Exports} = lists:keyfind(exports, 1, Info), + All = lists:sort(Exports), + {attributes, Attrs} = lists:keyfind(attributes, 1, Info), + {vsn,_} = lists:keyfind(vsn, 1, Attrs), + {compile, Compile} = lists:keyfind(compile, 1, Info), + {options,_} = lists:keyfind(options, 1, Compile), + ok. + %% Helper functions (local). add_arity(L) -> |