From 85290986334d2eb781eb9135277593a5613fa3c5 Mon Sep 17 00:00:00 2001 From: Patrik Nyblom Date: Fri, 19 Jul 2013 17:52:05 +0200 Subject: Integrate new PCRE test suites The relevant testoutputNN files were copied from the PCRE distribution and some corrections were done to run_pcre_tests.erl. Also made test generator be more compiler friendly The re_testoutput1_replacement_test and re_testoutput1_split_test modules that are generated by run_pcre_tests.erl (offline, when a new version of PCRE is integrated in the VM) took forever to compile, as one single huge function contained all the tests. The autogenerated tests are now split into ~50 functions, which reduces compile time to approximately a third. New automatic test suites are also generated from the new testoutputNN files, and checked in. --- lib/stdlib/test/re_SUITE.erl | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'lib/stdlib/test/re_SUITE.erl') diff --git a/lib/stdlib/test/re_SUITE.erl b/lib/stdlib/test/re_SUITE.erl index c05674b4f8..d86e5f5b91 100644 --- a/lib/stdlib/test/re_SUITE.erl +++ b/lib/stdlib/test/re_SUITE.erl @@ -24,7 +24,8 @@ global_capture/1,replace_input_types/1,replace_return/1, split_autogen/1,split_options/1,split_specials/1, error_handling/1,pcre_cve_2008_2371/1, - pcre_compile_workspace_overflow/1,re_infinite_loop/1]). + pcre_compile_workspace_overflow/1,re_infinite_loop/1, + re_backwards_accented/1]). -include_lib("test_server/include/test_server.hrl"). -include_lib("kernel/include/file.hrl"). @@ -36,7 +37,7 @@ all() -> replace_autogen, global_capture, replace_input_types, replace_return, split_autogen, split_options, split_specials, error_handling, pcre_cve_2008_2371, - pcre_compile_workspace_overflow, re_infinite_loop]. + pcre_compile_workspace_overflow, re_infinite_loop, re_backwards_accented]. groups() -> []. @@ -485,13 +486,13 @@ error_handling() -> ?line {match,[[{1,1},{1,1}]]} = re:run("apa",RE,[global]), ?line {'EXIT',{badarg,[{re,run, [<<"apa">>, - {re_pattern,1,0,_}, + {re_pattern,1,0,_,_}, [global,unicode]],_}, {?MODULE,error_handling,0,_} | _]}} = (catch re:run(<<"apa">>,RE,[global,unicode])), ?line {'EXIT',{badarg,[{re,run, ["apa", - {re_pattern,1,0,_}, + {re_pattern,1,0,_,_}, [global,unicode]],_}, {?MODULE,error_handling,0,_} | _]}} = (catch re:run("apa",RE,[global,unicode])), @@ -506,7 +507,7 @@ error_handling() -> (catch re:replace("apa",{1,2,3,4},"X",[global])), ?line {'EXIT',{badarg,[{re,replace, ["apa", - {re_pattern,1,0,_}, + {re_pattern,1,0,_,_}, "X", [unicode]],_}, {?MODULE,error_handling,0,_} | _]}} = @@ -609,3 +610,13 @@ re_infinite_loop(Config) when is_list(Config) -> ?line nomatch = re:run(Str, EMail_regex), ?t:timetrap_cancel(Dog), ok. +re_backwards_accented(doc) -> + "Check for nasty bug where accented graphemes can make PCRE back past " + "beginning of subject"; +re_backwards_accented(Config) when is_list(Config) -> + Dog = ?t:timetrap(?t:minutes(1)), + ?line match = re:run(<<65,204,128,65,204,128,97,98,99>>, + <<"\\X?abc">>, + [unicode,{capture,none}]), + ?t:timetrap_cancel(Dog), + ok. -- cgit v1.2.3