aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/test/map_SUITE.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-05-24 10:52:22 +0200
committerBjörn Gustavsson <[email protected]>2016-05-25 16:41:26 +0200
commit2a4281cf29a1fc7cc8408d7c42b60f930888133a (patch)
tree432e23361920cbe63da4fe22080138173c35b7e0 /lib/compiler/test/map_SUITE.erl
parentca368c8503712dce0044201bf25323ace3372a62 (diff)
downloadotp-2a4281cf29a1fc7cc8408d7c42b60f930888133a.tar.gz
otp-2a4281cf29a1fc7cc8408d7c42b60f930888133a.tar.bz2
otp-2a4281cf29a1fc7cc8408d7c42b60f930888133a.zip
v3_codegen: Don't confuse beam_validator
Generate code that not only is safe, but can easily be seen by beam_validator to be safe.
Diffstat (limited to 'lib/compiler/test/map_SUITE.erl')
-rw-r--r--lib/compiler/test/map_SUITE.erl20
1 files changed, 18 insertions, 2 deletions
diff --git a/lib/compiler/test/map_SUITE.erl b/lib/compiler/test/map_SUITE.erl
index 14d175b92c..c3c4862794 100644
--- a/lib/compiler/test/map_SUITE.erl
+++ b/lib/compiler/test/map_SUITE.erl
@@ -66,7 +66,9 @@
t_export/1,
%% errors in 18
- t_register_corruption/1
+ t_register_corruption/1,
+ t_bad_update/1
+
]).
suite() -> [].
@@ -117,7 +119,8 @@ all() ->
t_export,
%% errors in 18
- t_register_corruption
+ t_register_corruption,
+ t_bad_update
].
groups() -> [].
@@ -1922,6 +1925,19 @@ validate_frequency([{T,C}|Fs],Tf) ->
validate_frequency([], _) -> ok.
+t_bad_update(_Config) ->
+ {#{0.0:=Id},#{}} = properly(#{}),
+ 42 = Id(42),
+ {'EXIT',{{badmap,_},_}} = (catch increase(0)),
+ ok.
+
+properly(Item) ->
+ {Item#{0.0 => fun id/1},Item}.
+
+increase(Allows) ->
+ catch fun() -> Allows end#{[] => +Allows, "warranty" => fun id/1}.
+
+
%% aux
rand_terms(0) -> [];