aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2016-05-01 01:24:50 +0200
committerBjörn-Egil Dahlberg <[email protected]>2016-05-02 12:23:22 +0200
commitbbb4d3f3af2ed7b836db1b038cc7d2f96794428a (patch)
tree8d86221cfbe56600dfb5d5d1264659b2b7080e8a
parente37cf7645729842cae48286805e13071632bbab0 (diff)
downloadotp-bbb4d3f3af2ed7b836db1b038cc7d2f96794428a.tar.gz
otp-bbb4d3f3af2ed7b836db1b038cc7d2f96794428a.tar.bz2
otp-bbb4d3f3af2ed7b836db1b038cc7d2f96794428a.zip
stdlib: Strengthen map pattern tests
-rw-r--r--lib/stdlib/test/erl_lint_SUITE.erl20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/stdlib/test/erl_lint_SUITE.erl b/lib/stdlib/test/erl_lint_SUITE.erl
index 63dbc15410..b0214e5238 100644
--- a/lib/stdlib/test/erl_lint_SUITE.erl
+++ b/lib/stdlib/test/erl_lint_SUITE.erl
@@ -3603,6 +3603,26 @@ maps(Config) ->
{errors,[{1,erl_lint,illegal_map_construction},
{1,erl_lint,{unbound_var,'X'}}],
[]}},
+ {legal_map_pattern,
+ <<"
+ -record(mapkey, {a=1,b=2}).
+ t(M,K1) ->
+ #{ a := 1,
+ $a := 1, $z := 99,
+ #{a=>val} := 2,
+ K1 := 1337,
+ #mapkey{a = 10} := wat,
+ #{{a,val}=>val} := 2,
+ #{ \"hi\" => wazzup, hi => ho } := yep,
+ ok := 1.0,
+ [3+3] := nope,
+ 1.0 := yep,
+ {3.0+3} := nope,
+ {yep} := yep
+ } = M.
+ ">>,
+ [],
+ []},
{legal_map_construction,
<<"t(V) -> #{ a => 1,
#{a=>V} => 2,