aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tools/emacs/test.erl.indented
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2010-05-28 10:03:46 +0200
committerRaimo Niskanen <[email protected]>2010-06-01 13:16:39 +0200
commit16d48acbde6cd272c02ce7db2fd4dc8ad973f7d2 (patch)
tree7893305a171ace038f6c5727d7b1f0e4bac21f4b /lib/tools/emacs/test.erl.indented
parent6f1e1cd1e2c36e2d4b46d64b25ad6dff7cbe3609 (diff)
downloadotp-16d48acbde6cd272c02ce7db2fd4dc8ad973f7d2.tar.gz
otp-16d48acbde6cd272c02ce7db2fd4dc8ad973f7d2.tar.bz2
otp-16d48acbde6cd272c02ce7db2fd4dc8ad973f7d2.zip
Improved indentation of old catch.
An example that didn't work previously. case Foo of {ok, X} -> ok; _ -> catch file:close(FD) end.
Diffstat (limited to 'lib/tools/emacs/test.erl.indented')
-rw-r--r--lib/tools/emacs/test.erl.indented51
1 files changed, 48 insertions, 3 deletions
diff --git a/lib/tools/emacs/test.erl.indented b/lib/tools/emacs/test.erl.indented
index b94968a2b0..2948ccf1b5 100644
--- a/lib/tools/emacs/test.erl.indented
+++ b/lib/tools/emacs/test.erl.indented
@@ -512,7 +512,9 @@ indent_try_catch() ->
file:close(Xfile)
end;
indent_try_catch() ->
- try foo(bar) of
+ try
+ foo(bar)
+ of
X when true andalso
kalle ->
io:format(stdout, "Parsing file ~s, ",
@@ -570,14 +572,57 @@ indent_catch() ->
C = catch B +
float(43.1),
- case catch (X) of
+ case catch foo(X) of
+ A ->
+ B
+ end,
+
+ case
+ catch foo(X)
+ of
A ->
B
end,
+
+ case
+ foo(X)
+ of
+ A ->
+ catch B,
+ X
+ end,
+
try sune of
_ -> foo
catch _:_ -> baf
- end.
+ end,
+
+ try
+ sune
+ of
+ _ ->
+ X = 5,
+ (catch foo(X)),
+ X + 10
+ catch _:_ -> baf
+ end,
+
+ try
+ (catch sune)
+ of
+ _ ->
+ catch foo() %% BUGBUG can't handle catch inside try without parentheses
+ catch _:_ ->
+ baf
+ end,
+
+ try
+ (catch exit())
+ catch
+ _ ->
+ catch baf()
+ end,
+ ok.
indent_binary() ->
X = lists:foldr(fun(M) ->