aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/test
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2015-11-20 14:26:35 +0100
committerBjörn Gustavsson <[email protected]>2015-11-20 14:26:35 +0100
commit53bfaec70f9f6daaae079a1c5cd852f4df214b57 (patch)
tree4d1dd662a7f6ad2b7f5b7160a23c9daa0df1206a /lib/compiler/test
parent0bb72a96b95e856b4d4e12f6fb7ae73118259aba (diff)
parentd4bb044cb5359c6d4bffe3efcb8256cf7199bdf3 (diff)
downloadotp-53bfaec70f9f6daaae079a1c5cd852f4df214b57.tar.gz
otp-53bfaec70f9f6daaae079a1c5cd852f4df214b57.tar.bz2
otp-53bfaec70f9f6daaae079a1c5cd852f4df214b57.zip
Merge branch 'bjorn/compiler/fix-missing-filename/OTP-13113' into maint
* bjorn/compiler/fix-missing-filename/OTP-13113: Fix missing filename and line number in warning
Diffstat (limited to 'lib/compiler/test')
-rw-r--r--lib/compiler/test/bs_match_SUITE.erl22
1 files changed, 20 insertions, 2 deletions
diff --git a/lib/compiler/test/bs_match_SUITE.erl b/lib/compiler/test/bs_match_SUITE.erl
index 6e138b0a43..b4601b0798 100644
--- a/lib/compiler/test/bs_match_SUITE.erl
+++ b/lib/compiler/test/bs_match_SUITE.erl
@@ -36,7 +36,7 @@
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,binary_in_map/1,
- match_string_opt/1]).
+ match_string_opt/1,map_and_binary/1]).
-export([coverage_id/1,coverage_external_ignore/2]).
@@ -62,7 +62,7 @@ groups() ->
otp_7498,match_string,zero_width,bad_size,haystack,
cover_beam_bool,matched_out_size,follow_fail_branch,
no_partition,calling_a_binary,binary_in_map,
- match_string_opt]}].
+ match_string_opt,map_and_binary]}].
init_per_suite(Config) ->
@@ -1225,6 +1225,24 @@ match_string_opt(Config) when is_list(Config) ->
do_match_string_opt({<<1>>,{v,V}}=T) ->
{x,V,T}.
+%% If 'bin_opt_info' was given the warning would lack filename
+%% and line number.
+
+map_and_binary(_Config) ->
+ {<<"10">>,<<"37">>,<<"am">>} = do_map_and_binary(<<"10:37am">>),
+ Map1 = #{time => "noon"},
+ {ok,Map1} = do_map_and_binary(Map1),
+ Map2 = #{hour => 8, min => 42},
+ {8,42,Map2} = do_map_and_binary(Map2),
+ ok.
+
+do_map_and_binary(<<Hour:2/bytes, $:, Min:2/bytes, Rest/binary>>) ->
+ {Hour, Min, Rest};
+do_map_and_binary(#{time := _} = T) ->
+ {ok, T};
+do_map_and_binary(#{hour := Hour, min := Min} = T) ->
+ {Hour, Min, T}.
+
check(F, R) ->
R = F().