aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dialyzer/test
diff options
context:
space:
mode:
authorGustav Simonsson <[email protected]>2012-03-27 11:36:18 +0200
committerGustav Simonsson <[email protected]>2012-03-27 11:36:18 +0200
commit9d818854dd71c6bc3c6aaf8cb1bf596af7b8cf56 (patch)
tree53e373f9bfe5555c07b0db0f29f69037cf2757ba /lib/dialyzer/test
parent6c00fe82841a4d6ac81de0bdc2c110b3ce13947b (diff)
parent83f2fac3765d75ab46bc3871c2ac9a53d683edeb (diff)
downloadotp-9d818854dd71c6bc3c6aaf8cb1bf596af7b8cf56.tar.gz
otp-9d818854dd71c6bc3c6aaf8cb1bf596af7b8cf56.tar.bz2
otp-9d818854dd71c6bc3c6aaf8cb1bf596af7b8cf56.zip
Merge branch 'maint'
Diffstat (limited to 'lib/dialyzer/test')
-rw-r--r--lib/dialyzer/test/small_SUITE_data/src/maybe_servers.erl31
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/dialyzer/test/small_SUITE_data/src/maybe_servers.erl b/lib/dialyzer/test/small_SUITE_data/src/maybe_servers.erl
new file mode 100644
index 0000000000..237f43b1a6
--- /dev/null
+++ b/lib/dialyzer/test/small_SUITE_data/src/maybe_servers.erl
@@ -0,0 +1,31 @@
+-module(maybe_servers).
+
+-export([maybe_server/2, mirror_maybe_server/2]).
+
+maybe_server(O, I) ->
+ case O of
+ no ->
+ maybe_loop(fun(_) -> fin end, I);
+ yes ->
+ maybe_loop(fun(X) -> {ok, X} end, I)
+ end.
+
+maybe_loop(F, X)->
+ case F(X) of
+ {ok, Y} -> maybe_loop(F, Y);
+ fin -> exit(n)
+ end.
+
+mirror_maybe_loop(F, X)->
+ case F(X) of
+ {ok, Y} -> mirror_maybe_loop(F, Y);
+ fin -> exit(n)
+ end.
+
+mirror_maybe_server(O, I) ->
+ case O of
+ no ->
+ mirror_maybe_loop(fun(_) -> fin end, I);
+ yes ->
+ mirror_maybe_loop(fun(X) -> {ok, X} end, I)
+ end.