aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe/test/maps_SUITE_data/maps_update_assoc.erl
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2014-05-09 17:59:12 +0200
committerBjörn-Egil Dahlberg <[email protected]>2014-05-09 17:59:12 +0200
commit1c817ecd054780551bcbe8b5a0e30bea2b3da04e (patch)
treee1a57c1592b3662cc785f4770e210140593a9986 /lib/hipe/test/maps_SUITE_data/maps_update_assoc.erl
parent659213c7facb71410fe990d5099abf3019c58b3e (diff)
parentf6d5234c391a0ba834337c3e92ee5fb377834a32 (diff)
downloadotp-1c817ecd054780551bcbe8b5a0e30bea2b3da04e.tar.gz
otp-1c817ecd054780551bcbe8b5a0e30bea2b3da04e.tar.bz2
otp-1c817ecd054780551bcbe8b5a0e30bea2b3da04e.zip
Merge branch 'ks/hipe-map-support/OTP-11900' into maint
* ks/hipe-map-support/OTP-11900: Add five new test files for maps in the HiPE test suite Copy the tests for maps from the compiler application to a new HiPE test suite Translate the put_map_assoc and put_map_exact BEAM instructions to ICode Translate the has_map_fields and get_map_elements BEAM instructions to ICode
Diffstat (limited to 'lib/hipe/test/maps_SUITE_data/maps_update_assoc.erl')
-rw-r--r--lib/hipe/test/maps_SUITE_data/maps_update_assoc.erl22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/hipe/test/maps_SUITE_data/maps_update_assoc.erl b/lib/hipe/test/maps_SUITE_data/maps_update_assoc.erl
new file mode 100644
index 0000000000..cc7c1353de
--- /dev/null
+++ b/lib/hipe/test/maps_SUITE_data/maps_update_assoc.erl
@@ -0,0 +1,22 @@
+-module(maps_update_assoc).
+-export([test/0]).
+
+test() ->
+ M0 = id(#{1=>a,2=>b,3.0=>c,4=>d,5=>e}),
+
+ M1 = M0#{1=>42,2=>100,4=>[a,b,c]},
+ #{1:=42,2:=100,3.0:=c,4:=[a,b,c],5:=e} = M1,
+ #{1:=42,2:=b,4:=d,5:=e,2.0:=100,3.0:=c,4.0:=[a,b,c]} = M0#{1.0=>float,1:=42,2.0=>wrong,2.0=>100,4.0=>[a,b,c]},
+
+ M2 = M0#{3.0=>new},
+ #{1:=a,2:=b,3.0:=new,4:=d,5:=e} = M2,
+ M2 = M0#{3.0:=wrong,3.0=>new},
+
+ %% Errors cases.
+ BadMap = id(badmap),
+ {'EXIT',{badarg,_}} = (catch BadMap#{nonexisting=>val}),
+
+ ok.
+
+%% Use this function to avoid compile-time evaluation of an expression.
+id(I) -> I.