aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tools
diff options
context:
space:
mode:
authorAnthony Ramine <[email protected]>2012-11-10 21:32:31 +0100
committerAnthony Ramine <[email protected]>2013-12-12 12:54:24 +0100
commita0988a638a92211ae0af6ec35ca99edfc05110aa (patch)
treec7aad667d8a85bf543459baa767c2ca21b396ae8 /lib/tools
parenta122254898597d73658e72070862e2da0d1cf85b (diff)
downloadotp-a0988a638a92211ae0af6ec35ca99edfc05110aa.tar.gz
otp-a0988a638a92211ae0af6ec35ca99edfc05110aa.tar.bz2
otp-a0988a638a92211ae0af6ec35ca99edfc05110aa.zip
Test named funs
Diffstat (limited to 'lib/tools')
-rw-r--r--lib/tools/test/cover_SUITE.erl18
-rw-r--r--lib/tools/test/xref_SUITE.erl13
-rw-r--r--lib/tools/test/xref_SUITE_data/read/read.erl27
3 files changed, 35 insertions, 23 deletions
diff --git a/lib/tools/test/cover_SUITE.erl b/lib/tools/test/cover_SUITE.erl
index 29b26c7a76..bd71218474 100644
--- a/lib/tools/test/cover_SUITE.erl
+++ b/lib/tools/test/cover_SUITE.erl
@@ -28,7 +28,7 @@
export_import/1,
otp_5031/1, eif/1, otp_5305/1, otp_5418/1, otp_6115/1, otp_7095/1,
otp_8188/1, otp_8270/1, otp_8273/1, otp_8340/1,
- otp_10979_hanging_node/1, compile_beam_opts/1]).
+ otp_10979_hanging_node/1, compile_beam_opts/1, eep37/1]).
-include_lib("test_server/include/test_server.hrl").
@@ -53,7 +53,7 @@ all() ->
dont_reconnect_after_stop, stop_node_after_disconnect,
export_import, otp_5031, eif, otp_5305, otp_5418,
otp_6115, otp_7095, otp_8188, otp_8270, otp_8273,
- otp_8340, otp_10979_hanging_node, compile_beam_opts];
+ otp_8340, otp_10979_hanging_node, compile_beam_opts, eep37];
_pid ->
{skip,
"It looks like the test server is running "
@@ -1382,6 +1382,20 @@ comprehension_8188(Cf) ->
ok.
+eep37(Config) when is_list(Config) ->
+ [{{t,1},1},{{t,2},1},{{t,4},6},{{t,6},1},{{t,8},1}] =
+ analyse_expr(<<"begin\n" % 1
+ " F =\n" % 1
+ " fun Fact(N) when N > 0 ->\n"
+ " N * Fact(N - 1);\n" % 6
+ " Fact(0) ->\n"
+ " 1\n" % 1
+ " end,\n"
+ " F(6)\n" % 1
+ "end\n">>,
+ Config),
+ ok.
+
otp_10979_hanging_node(_Config) ->
P1 = processes(),
diff --git a/lib/tools/test/xref_SUITE.erl b/lib/tools/test/xref_SUITE.erl
index 31b0b13b7b..3e9eaf259c 100644
--- a/lib/tools/test/xref_SUITE.erl
+++ b/lib/tools/test/xref_SUITE.erl
@@ -1047,7 +1047,7 @@ read_expected(Version) ->
POS1 = 28, POS2 = POS1+10, POS3 = POS2+6, POS4 = POS3+6, POS5 = POS4+10,
POS6 = POS5+5, POS7 = POS6+6, POS8 = POS7+6, POS9 = POS8+8,
POS10 = POS9+10, POS11 = POS10+7, POS12 = POS11+8, POS13 = POS12+10,
- POS14 = POS13+18, % POS15 = POS14+23,
+ POS14 = POS13+18, POS15 = POS14+23,
FF = {read,funfuns,0},
U = [{POS1+5,{FF,{dist,'$F_EXPR',0}}},
@@ -1196,11 +1196,6 @@ read_expected(Version) ->
{0,{FF,{modul,'$F_EXPR',179}}}]
++ O1;
_ ->
-% [{POS15+2,{{read,bi,0},{foo,t,0}}},
-% {POS15+3,{{read,bi,0},{bar,t,0}}},
-% {POS15+6,{{read,bi,0},{read,local,0}}},
-% {POS15+8,{{read,bi,0},{foo,t,0}}},
-% {POS15+10,{{read,bi,0},{bar,t,0}}}] ++
[{16,{FF,{read,'$F_EXPR',178}}},
{17,{FF,{modul,'$F_EXPR',179}}}]
++
@@ -1227,7 +1222,11 @@ read_expected(Version) ->
_ ->
[{POS13+16, {{read,bi,0},{erlang,'!',2}}},
{POS13+16, {{read,bi,0},{erlang,'-',1}}},
- {POS13+16, {{read,bi,0},{erlang,self,0}}}]
+ {POS13+16, {{read,bi,0},{erlang,self,0}}},
+ {POS15+1, {{read,bi,0},{erlang,'>',2}}},
+ {POS15+2, {{read,bi,0},{erlang,'-',2}}},
+ {POS15+2, {{read,bi,0},{erlang,'*',2}}},
+ {POS15+8, {{read,bi,0},{erlang,'/',2}}}]
end
++ [{POS14+19, {{read,bi,0},{erlang,'+',2}}},
{POS14+21, {{read,bi,0},{erlang,'+',2}}},
diff --git a/lib/tools/test/xref_SUITE_data/read/read.erl b/lib/tools/test/xref_SUITE_data/read/read.erl
index 19694c9e25..5f388194b0 100644
--- a/lib/tools/test/xref_SUITE_data/read/read.erl
+++ b/lib/tools/test/xref_SUITE_data/read/read.erl
@@ -156,20 +156,19 @@ bi() ->
<<D:16, E, F/binary>> = Bin3,
X = 9, <<(X+1):8>>,
_Fyy = <<X:4/little-signed-integer-unit:8>>,
- D + E + F.
-%bi() ->
-% %% POS15=POS14+13
-% try
-% foo:t(),
-% bar:t()
-% of
-% {v,1} ->
-% local();
-% {v,2} ->
-% foo:t()
-% catch
-% {'EXIT',_} -> bar:t()
-% end.
+ D + E + F;
+bi() ->
+ %% EEP37. POS15=POS14+23
+ F = fun Fact(N) when N > 0 ->
+ N * Fact(N - 1);
+ Fact(0) ->
+ 1
+ end,
+ F(6),
+ G = fun _(foo) -> bar;
+ _(X) -> X / 3
+ end,
+ G(foo).
local() ->
true.