diff options
author | John Högberg <[email protected]> | 2018-02-28 09:10:05 +0100 |
---|---|---|
committer | John Högberg <[email protected]> | 2018-02-28 09:10:05 +0100 |
commit | 3b62e9dde9153fe8dcc1f1f5bfa97b7cb591c901 (patch) | |
tree | f5e6f5022fad4038f65070a7f6588a1654eb3776 /lib/stdlib/test | |
parent | 1e5df276a60b0968833a8483cf4a219b3dc5639e (diff) | |
parent | b600910bf17c92721fb8da04e8c508d6395dabc4 (diff) | |
download | otp-3b62e9dde9153fe8dcc1f1f5bfa97b7cb591c901.tar.gz otp-3b62e9dde9153fe8dcc1f1f5bfa97b7cb591c901.tar.bz2 otp-3b62e9dde9153fe8dcc1f1f5bfa97b7cb591c901.zip |
Merge branch 'maint'
* maint:
Skip testing unavailable interfaces in inet_SUITE:getifaddrs
Make re_SUITE:sub_binaries less unstable
Diffstat (limited to 'lib/stdlib/test')
-rw-r--r-- | lib/stdlib/test/re_SUITE.erl | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/stdlib/test/re_SUITE.erl b/lib/stdlib/test/re_SUITE.erl index 71f86e32e5..7b82647416 100644 --- a/lib/stdlib/test/re_SUITE.erl +++ b/lib/stdlib/test/re_SUITE.erl @@ -894,10 +894,13 @@ match_limit(Config) when is_list(Config) -> %% Test that we get sub-binaries if subject is a binary and we capture %% binaries. sub_binaries(Config) when is_list(Config) -> - Bin = list_to_binary(lists:seq(1,255)), - {match,[B,C]}=re:run(Bin,"(a)",[{capture,all,binary}]), - 255 = binary:referenced_byte_size(B), - 255 = binary:referenced_byte_size(C), - {match,[D]}=re:run(Bin,"(a)",[{capture,[1],binary}]), - 255 = binary:referenced_byte_size(D), + %% The GC can auto-convert tiny sub-binaries to heap binaries, so we + %% extract large sequences to make the test more stable. + Bin = << <<I>> || I <- lists:seq(1, 4096) >>, + {match,[B,C]}=re:run(Bin,"a(.+)$",[{capture,all,binary}]), + true = byte_size(B) =/= byte_size(C), + 4096 = binary:referenced_byte_size(B), + 4096 = binary:referenced_byte_size(C), + {match,[D]}=re:run(Bin,"a(.+)$",[{capture,[1],binary}]), + 4096 = binary:referenced_byte_size(D), ok. |