aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2011-04-06 13:32:55 +0200
committerBjörn Gustavsson <[email protected]>2011-04-12 05:52:25 +0200
commit3235b9e006298750a9239de0139545018597befd (patch)
tree80c89f7d8226c6f97293c6ecb943a4e905434fea /lib/compiler
parent236b6e32118bfc064f88bebf9945080ed8ea9eb4 (diff)
downloadotp-3235b9e006298750a9239de0139545018597befd.tar.gz
otp-3235b9e006298750a9239de0139545018597befd.tar.bz2
otp-3235b9e006298750a9239de0139545018597befd.zip
record_SUITE: Cover optimization of is_record/3 in beam_type
Since the introduction of improved record optimizations in 1858cb81391d2bce29b4b7620574ca60128cebf7 and 470c91d43eae54f63661645acbce4b92d73287cc, the optimization of a is_record/3 call with a known correct type in beam_type:simplify_basic_1/3 has not been covered.
Diffstat (limited to 'lib/compiler')
-rw-r--r--lib/compiler/test/record_SUITE.erl19
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/compiler/test/record_SUITE.erl b/lib/compiler/test/record_SUITE.erl
index 59860cb605..363422ec7e 100644
--- a/lib/compiler/test/record_SUITE.erl
+++ b/lib/compiler/test/record_SUITE.erl
@@ -26,7 +26,8 @@
init_per_group/2,end_per_group/2,
init_per_testcase/2,end_per_testcase/2,
errors/1,record_test_2/1,record_test_3/1,record_access_in_guards/1,
- guard_opt/1,eval_once/1,foobar/1,missing_test_heap/1, nested_access/1]).
+ guard_opt/1,eval_once/1,foobar/1,missing_test_heap/1,
+ nested_access/1,coverage/1]).
init_per_testcase(_Case, Config) ->
?line Dog = test_server:timetrap(test_server:minutes(2)),
@@ -43,7 +44,7 @@ all() ->
test_lib:recompile(?MODULE),
[errors, record_test_2, record_test_3,
record_access_in_guards, guard_opt, eval_once, foobar,
- missing_test_heap, nested_access].
+ missing_test_heap, nested_access, coverage].
groups() ->
[].
@@ -568,4 +569,18 @@ nested_access(Config) when is_list(Config) ->
?line N2a = N2b,
ok.
+-record(rr, {a,b,c}).
+
+coverage(Config) when is_list(Config) ->
+ %% There should only remain one record test in the code below.
+ R0 = id(#rr{a=1,b=2,c=3}),
+ B = R0#rr.b, %Test the record here.
+ R = R0#rr{c=42}, %No need to test here.
+ if
+ B > R#rr.a -> %No need to test here.
+ ok
+ end,
+ #rr{a=1,b=2,c=42} = id(R), %Test for correctness.
+ ok.
+
id(I) -> I.