aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2011-12-29 15:14:04 +0100
committerBjörn Gustavsson <[email protected]>2012-01-04 16:14:19 +0100
commitba0adbfc6a0947f2ef34855e88010fc1df78c86b (patch)
tree0a5a7d9ed6ac361712ac2e59c1f9085d2daeafdd /lib/compiler
parentd2c8975549f8496dd5e79c3862a25504c06fca9e (diff)
downloadotp-ba0adbfc6a0947f2ef34855e88010fc1df78c86b.tar.gz
otp-ba0adbfc6a0947f2ef34855e88010fc1df78c86b.tar.bz2
otp-ba0adbfc6a0947f2ef34855e88010fc1df78c86b.zip
core_fold_SUITE: Cover sys_core_fold:is_safe_bool_expr_1/3
Diffstat (limited to 'lib/compiler')
-rw-r--r--lib/compiler/test/core_fold_SUITE.erl14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/compiler/test/core_fold_SUITE.erl b/lib/compiler/test/core_fold_SUITE.erl
index ac14d36e82..fb5ec88c9f 100644
--- a/lib/compiler/test/core_fold_SUITE.erl
+++ b/lib/compiler/test/core_fold_SUITE.erl
@@ -214,6 +214,7 @@ coverage(Config) when is_list(Config) ->
(catch cover_will_match_list_type({a,b,c,d})),
?line a = cover_remove_non_vars_alias({a,b,c}),
?line error = cover_will_match_lit_list(),
+ {ok,[a]} = cover_is_safe_bool_expr(a),
%% Make sure that we don't attempt to make literals
%% out of pids. (Putting a pid into a #c_literal{}
@@ -249,4 +250,17 @@ cover_will_match_lit_list() ->
error
end.
+cover_is_safe_bool_expr(X) ->
+ %% Use a try...catch that looks like a try...catch in a guard.
+ try
+ %% let V = [X] in {ok,V}
+ %% is_safe_simple([X]) ==> true
+ %% is_safe_bool_expr([X]) ==> false
+ V = [X],
+ {ok,V}
+ catch
+ _:_ ->
+ false
+ end.
+
id(I) -> I.