diff options
author | Björn Gustavsson <[email protected]> | 2015-01-21 10:03:00 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2015-01-21 10:03:00 +0100 |
commit | c0569ad830f841d5df16bd75a6f5d0e584202b05 (patch) | |
tree | f1d141e4fe66e30644bd85a2eca7d46a5eaf83d7 /lib/compiler/test | |
parent | 677cb69c4c919e40d074df3bae40338a375a4731 (diff) | |
parent | bb561b0dd58a89489acb93bdf7b5386e7f306835 (diff) | |
download | otp-c0569ad830f841d5df16bd75a6f5d0e584202b05.tar.gz otp-c0569ad830f841d5df16bd75a6f5d0e584202b05.tar.bz2 otp-c0569ad830f841d5df16bd75a6f5d0e584202b05.zip |
Merge branch 'bjorn/compiler/map-pattern/OTP-12414' into maint
* bjorn/compiler/map-pattern/OTP-12414:
core_lib: Handle patterns in map values
Diffstat (limited to 'lib/compiler/test')
-rw-r--r-- | lib/compiler/test/bs_match_SUITE.erl | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/lib/compiler/test/bs_match_SUITE.erl b/lib/compiler/test/bs_match_SUITE.erl index 149b9bbb8f..10e3451e8f 100644 --- a/lib/compiler/test/bs_match_SUITE.erl +++ b/lib/compiler/test/bs_match_SUITE.erl @@ -34,7 +34,7 @@ otp_7188/1,otp_7233/1,otp_7240/1,otp_7498/1, match_string/1,zero_width/1,bad_size/1,haystack/1, cover_beam_bool/1,matched_out_size/1,follow_fail_branch/1, - no_partition/1,calling_a_binary/1]). + no_partition/1,calling_a_binary/1,binary_in_map/1]). -export([coverage_id/1,coverage_external_ignore/2]). @@ -59,7 +59,7 @@ groups() -> matching_and_andalso,otp_7188,otp_7233,otp_7240, otp_7498,match_string,zero_width,bad_size,haystack, cover_beam_bool,matched_out_size,follow_fail_branch, - no_partition,calling_a_binary]}]. + no_partition,calling_a_binary,binary_in_map]}]. init_per_suite(Config) -> @@ -1189,6 +1189,26 @@ call_binary(<<>>, Acc) -> call_binary(<<H,T/bits>>, Acc) -> T(<<Acc/binary,H>>). +binary_in_map(Config) when is_list(Config) -> + ok = match_binary_in_map(#{key => <<42:8>>}), + {'EXIT',{{badmatch,#{key := 1}},_}} = + (catch match_binary_in_map(#{key => 1})), + {'EXIT',{{badmatch,#{key := <<1023:16>>}},_}} = + (catch match_binary_in_map(#{key => <<1023:16>>})), + {'EXIT',{{badmatch,#{key := <<1:8>>}},_}} = + (catch match_binary_in_map(#{key => <<1:8>>})), + {'EXIT',{{badmatch,not_a_map},_}} = + (catch match_binary_in_map(not_a_map)), + ok. + +match_binary_in_map(Map) -> + case 8 of + N -> + #{key := <<42:N>>} = Map, + ok + end. + + check(F, R) -> R = F(). |