diff options
author | Patrik Nyblom <[email protected]> | 2011-11-10 17:52:39 +0100 |
---|---|---|
committer | Patrik Nyblom <[email protected]> | 2011-11-16 17:07:37 +0100 |
commit | b764d3fe3446a5744fc0441ba4ecf5ac169612e7 (patch) | |
tree | 6d1fb3f7330feaa8a271578d0a7d913555c92146 /lib/stdlib | |
parent | 8e8fa01525dabf757009054798569aba115d2952 (diff) | |
download | otp-b764d3fe3446a5744fc0441ba4ecf5ac169612e7.tar.gz otp-b764d3fe3446a5744fc0441ba4ecf5ac169612e7.tar.bz2 otp-b764d3fe3446a5744fc0441ba4ecf5ac169612e7.zip |
Make binary:match with scope return correct values
Diffstat (limited to 'lib/stdlib')
-rw-r--r-- | lib/stdlib/test/binary_module_SUITE.erl | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/stdlib/test/binary_module_SUITE.erl b/lib/stdlib/test/binary_module_SUITE.erl index 8fb63f33bd..bac59a3107 100644 --- a/lib/stdlib/test/binary_module_SUITE.erl +++ b/lib/stdlib/test/binary_module_SUITE.erl @@ -20,7 +20,7 @@ -export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, init_per_group/2,end_per_group/2, - interesting/1,random_ref_comp/1,random_ref_sr_comp/1, + interesting/1,scope_return/1,random_ref_comp/1,random_ref_sr_comp/1, random_ref_fla_comp/1,parts/1, bin_to_list/1, list_to_bin/1, copy/1, referenced/1,guard/1,encode_decode/1,badargs/1,longest_common_trap/1]). @@ -67,7 +67,7 @@ end_per_testcase(_Case, Config) -> suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> - [interesting, random_ref_fla_comp, random_ref_sr_comp, + [scope_return,interesting, random_ref_fla_comp, random_ref_sr_comp, random_ref_comp, parts, bin_to_list, list_to_bin, copy, referenced, guard, encode_decode, badargs, longest_common_trap]. @@ -379,6 +379,20 @@ subj() -> Subject. +scope_return(doc) -> + ["Test correct return values for scopes (OTP-9701)."]; +scope_return(Config) when is_list(Config) -> + N=10000, + Bin=binary:copy(<<"a">>,N), + scope_loop(Bin,0,N). + +scope_loop(_,N,N) -> + ok; +scope_loop(Bin,N,M) -> + ?line {N,1} = binary:match(Bin,<<"a">>,[{scope,{N,1}}]), + ?line {N,1} = binary:match(Bin,[<<"a">>,<<"b">>],[{scope,{N,1}}]), + scope_loop(Bin,N+1,M). + interesting(doc) -> ["Try some interesting patterns"]; interesting(Config) when is_list(Config) -> |