aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/test
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2019-01-30 11:29:08 +0100
committerGitHub <[email protected]>2019-01-30 11:29:08 +0100
commit135f98f4481e57f82c03c74a41ebde649af40f04 (patch)
tree1405d186ab931e7c936f01610a03aadefb8f9ae2 /lib/compiler/test
parent5b0f748c15d6dcdae4cb18c45b9fca92e45a5cc6 (diff)
parent86f82183855d6b21912e0e125b096a28a52bbcf6 (diff)
downloadotp-135f98f4481e57f82c03c74a41ebde649af40f04.tar.gz
otp-135f98f4481e57f82c03c74a41ebde649af40f04.tar.bz2
otp-135f98f4481e57f82c03c74a41ebde649af40f04.zip
Merge pull request #2115 from bjorng/bjorn/compiler/opt-function_clause
Enhance optimization of function_clause exceptions
Diffstat (limited to 'lib/compiler/test')
-rw-r--r--lib/compiler/test/beam_except_SUITE.erl12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/compiler/test/beam_except_SUITE.erl b/lib/compiler/test/beam_except_SUITE.erl
index da61931136..49acad2bc5 100644
--- a/lib/compiler/test/beam_except_SUITE.erl
+++ b/lib/compiler/test/beam_except_SUITE.erl
@@ -88,8 +88,17 @@ coverage(_) ->
{'EXIT',{{strange,Self},[{?MODULE,foo,[any],[File,{line,14}]}|_]}} =
(catch foo(any)),
+ {ok,succeed,1,2} = foobar(succeed, 1, 2),
+ {'EXIT',{function_clause,[{?MODULE,foobar,[[fail],1,2],
+ [{file,"fake.erl"},{line,16}]}|_]}} =
+ (catch foobar([fail], 1, 2)),
+ {'EXIT',{function_clause,[{?MODULE,fake_function_clause,[{a,b},42.0],_}|_]}} =
+ (catch fake_function_clause({a,b})),
+
ok.
+fake_function_clause(A) -> error(function_clause, [A,42.0]).
+
-file("fake.erl", 1).
fc(a) -> %Line 2
ok; %Line 3
@@ -104,3 +113,6 @@ bar(X) -> %Line 8
%% Cover collection code for function_clause exceptions.
foo(A) -> %Line 13
error({strange,self()}, [A]). %Line 14
+%% Cover beam_except:tag_literal/1.
+foobar(A, B, C) when is_atom(A) -> %Line 16
+ {ok,A,B,C}. %Line 17