aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/test/fun_SUITE.erl
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2014-07-11 17:43:32 +0200
committerBjörn-Egil Dahlberg <[email protected]>2014-07-11 17:44:06 +0200
commite47da13f6a0b73a2cae5d5f602ac25c4ff3c440d (patch)
treee1f9871c7666638f4e10c6f3d99cfeda77c43545 /erts/emulator/test/fun_SUITE.erl
parente1f903d5210fb5b91ff47229fb57bf3b0edeb79e (diff)
downloadotp-e47da13f6a0b73a2cae5d5f602ac25c4ff3c440d.tar.gz
otp-e47da13f6a0b73a2cae5d5f602ac25c4ff3c440d.tar.bz2
otp-e47da13f6a0b73a2cae5d5f602ac25c4ff3c440d.zip
erts: Test erlang:fun_info_mfa/1
Diffstat (limited to 'erts/emulator/test/fun_SUITE.erl')
-rw-r--r--erts/emulator/test/fun_SUITE.erl23
1 files changed, 21 insertions, 2 deletions
diff --git a/erts/emulator/test/fun_SUITE.erl b/erts/emulator/test/fun_SUITE.erl
index 8ad5f290ed..2968f5bebb 100644
--- a/erts/emulator/test/fun_SUITE.erl
+++ b/erts/emulator/test/fun_SUITE.erl
@@ -30,7 +30,7 @@
fun_to_port/1,t_hash/1,t_phash/1,t_phash2/1,md5/1,
refc/1,refc_ets/1,refc_dist/1,
const_propagation/1,t_arity/1,t_is_function2/1,
- t_fun_info/1]).
+ t_fun_info/1,t_fun_info_mfa/1]).
-export([nothing/0]).
@@ -42,7 +42,8 @@ all() ->
[bad_apply, bad_fun_call, badarity, ext_badarity,
equality, ordering, fun_to_port, t_hash, t_phash,
t_phash2, md5, refc, refc_ets, refc_dist,
- const_propagation, t_arity, t_is_function2, t_fun_info].
+ const_propagation, t_arity, t_is_function2, t_fun_info,
+ t_fun_info_mfa].
groups() ->
[].
@@ -824,6 +825,24 @@ t_fun_info(Config) when is_list(Config) ->
?line bad_info(<<1,2>>),
ok.
+t_fun_info_mfa(Config) when is_list(Config) ->
+ Fun1 = fun spawn_call/2,
+ {module,M1} = erlang:fun_info(Fun1, module),
+ {name,F1} = erlang:fun_info(Fun1, name),
+ {arity,A1} = erlang:fun_info(Fun1, arity),
+ {M1,F1,A1=2} = erlang:fun_info_mfa(Fun1),
+ %% Module fun.
+ Fun2 = fun ?MODULE:t_fun_info/1,
+ {module,M2} = erlang:fun_info(Fun2, module),
+ {name,F2} = erlang:fun_info(Fun2, name),
+ {arity,A2} = erlang:fun_info(Fun2, arity),
+ {M2,F2,A2=1} = erlang:fun_info_mfa(Fun2),
+
+ %% Not fun.
+ {'EXIT',_} = (catch erlang:fun_info_mfa(id(d))),
+ ok.
+
+
bad_info(Term) ->
try erlang:fun_info(Term, module) of
Any ->