diff options
author | Björn Gustavsson <[email protected]> | 2016-02-28 14:10:25 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2016-03-09 13:20:01 +0100 |
commit | 03ec5bc984264feee907408e720015e2bd9b6108 (patch) | |
tree | 9ef15f88514aeb1f9dc612ef38a706ae42d0c750 /lib/stdlib/test/re_SUITE.erl | |
parent | 11603b076ff9fe8ee1b0687db5dc8411fae318d4 (diff) | |
download | otp-03ec5bc984264feee907408e720015e2bd9b6108.tar.gz otp-03ec5bc984264feee907408e720015e2bd9b6108.tar.bz2 otp-03ec5bc984264feee907408e720015e2bd9b6108.zip |
Eliminate 'suite' and 'doc' clauses
Diffstat (limited to 'lib/stdlib/test/re_SUITE.erl')
-rw-r--r-- | lib/stdlib/test/re_SUITE.erl | 79 |
1 files changed, 31 insertions, 48 deletions
diff --git a/lib/stdlib/test/re_SUITE.erl b/lib/stdlib/test/re_SUITE.erl index d1720bd4bc..a27f1e8a7d 100644 --- a/lib/stdlib/test/re_SUITE.erl +++ b/lib/stdlib/test/re_SUITE.erl @@ -63,16 +63,14 @@ end_per_group(_GroupName, Config) -> Config. -pcre(doc) -> - ["Run all applicable tests from the PCRE testsuites."]; +%% Run all applicable tests from the PCRE testsuites. pcre(Config) when is_list(Config) -> RootDir = ?config(data_dir, Config), Res = run_pcre_tests:test(RootDir), 0 = lists:sum([ X || {X,_,_} <- Res ]), {comment,Res}. -compile_options(doc) -> - ["Test all documented compile options"]; +%% Test all documented compile options. compile_options(Config) when is_list(Config) -> ?line ok = ctest("ABDabcdABCD","abcd",[],true,{match,[{3,4}]}), ?line ok = ctest("ABDabcdABCD","abcd",[anchored],true,nomatch), @@ -111,8 +109,7 @@ compile_options(Config) when is_list(Config) -> ?line ok = ctest("abcdABCabcd\n","abcd$",[{newline,anycrlf}],true,{match,[{7,4}]}), ok. -run_options(doc) -> - ["Test all documented run specific options"]; +%% Test all documented run specific options. run_options(Config) when is_list(Config) -> ?line rtest("ABCabcdABC","abc",[],[],true), ?line rtest("ABCabcdABC","abc",[anchored],[],false), @@ -197,8 +194,7 @@ run_options(Config) when is_list(Config) -> -combined_options(doc) -> - ["Test compile options given directly to run"]; +%% Test compile options given directly to run. combined_options(Config) when is_list(Config) -> ?line ok = crtest("ABDabcdABCD","abcd",[],true,{match,[{3,4}]}), ?line ok = crtest("ABDabcdABCD","abcd",[anchored],true,nomatch), @@ -267,14 +263,12 @@ combined_options(Config) when is_list(Config) -> ?line nomatch = re:run("ABC\nD","[a-z]*",[{newline,crlf},notempty]), ok. -replace_autogen(doc) -> - ["Test replace with autogenerated erlang module"]; +%% Test replace with autogenerated erlang module. replace_autogen(Config) when is_list(Config) -> re_testoutput1_replacement_test:run(), ok. -global_capture(doc) -> - ["Tests capture options together with global searching"]; +%% Test capture options together with global searching. global_capture(Config) when is_list(Config) -> ?line {match,[{3,4}]} = re:run("ABCabcdABC",".*(?<FOO>abcd).*",[{capture,[1]}]), ?line {match,[{10,4}]} = re:run("ABCabcdABCabcdA",".*(?<FOO>abcd).*",[{capture,[1]}]), @@ -301,16 +295,14 @@ global_capture(Config) when is_list(Config) -> ?line {match,[[{3,5},{5,3}],[{11,4},{12,3}]]} = re:run("ABCÅbcdABCabcdA",".(?<FOO>bcd)",[global,{capture,all,index},unicode]), ok. -replace_input_types(doc) -> - ["Tests replace with different input types"]; +%% Test replace with different input types. replace_input_types(Config) when is_list(Config) -> ?line <<"abcd">> = re:replace("abcd","Z","X",[{return,binary},unicode]), ?line <<"abcd">> = re:replace("abcd","\x{400}","X",[{return,binary},unicode]), ?line <<"a",208,128,"cd">> = re:replace(<<"abcd">>,"b","\x{400}",[{return,binary},unicode]), ok. -replace_return(doc) -> - ["Tests return options of replace together with global searching"]; +%% Test return options of replace together with global searching. replace_return(Config) when is_list(Config) -> {'EXIT',{badarg,_}} = (catch re:replace("na","(a","")), ok = replacetest(<<"nisse">>,"i","a",[{return,binary}],<<"nasse">>), @@ -404,14 +396,12 @@ copt(ungreedy) -> true; copt(unicode) -> true; copt(_) -> false. -split_autogen(doc) -> - ["Test split with autogenerated erlang module"]; +%% Test split with autogenerated erlang module. split_autogen(Config) when is_list(Config) -> re_testoutput1_split_test:run(), ok. -split_options(doc) -> - ["Test special options to split."]; +%% Test special options to split. split_options(Config) when is_list(Config) -> ok = splittest("a b c ","( )",[group,trim],[[<<"a">>,<<" ">>],[<<"b">>,<<" ">>],[<<"c">>,<<" ">>]]), ok = splittest("a b c ","( )",[group,{parts,0}],[[<<"a">>,<<" ">>],[<<"b">>,<<" ">>],[<<"c">>,<<" ">>]]), @@ -436,8 +426,7 @@ join([]) -> []; join([A]) -> [A]; join([H|T]) -> [H,<<":">>|join(T)]. -split_specials(doc) -> - ["Some special cases of split that are easy to get wrong."]; +%% Some special cases of split that are easy to get wrong. split_specials(Config) when is_list(Config) -> %% More or less just to remember these icky cases ?line <<"::abd:f">> = @@ -613,22 +602,21 @@ error_handling() -> (catch re:split("apa","(p",[banana])), ok. -pcre_cve_2008_2371(doc) -> - "Fix as in http://vcs.pcre.org/viewvc?revision=360&view=revision"; +%% Fix as in http://vcs.pcre.org/viewvc?revision=360&view=revision pcre_cve_2008_2371(Config) when is_list(Config) -> %% Make sure it doesn't crash the emulator. re:compile(<<"(?i)[\xc3\xa9\xc3\xbd]|[\xc3\xa9\xc3\xbdA]">>, [unicode]), ok. -pcre_compile_workspace_overflow(doc) -> - "Patch from http://vcs.pcre.org/viewvc/code/trunk/pcre_compile.c?r1=504&r2=505&view=patch"; +%% Patch from +%% http://vcs.pcre.org/viewvc/code/trunk/pcre_compile.c?r1=504&r2=505&view=patch pcre_compile_workspace_overflow(Config) when is_list(Config) -> N = 819, ?line {error,{"internal error: overran compiling workspace",799}} = re:compile([lists:duplicate(N, $(), lists:duplicate(N, $))]), ok. -re_infinite_loop(doc) -> - "Make sure matches that really loop infinitely actually fail"; + +%% Make sure matches that really loop infinitely actually fail. re_infinite_loop(Config) when is_list(Config) -> Str = "http:/www.flickr.com/slideShow/index.gne?group_id=&user_id=69845378@N0", @@ -642,16 +630,16 @@ re_infinite_loop(Config) when is_list(Config) -> {error,match_limit} = re:run(Str, EMail_regex,[report_errors]), {error,match_limit} = re:run(Str, EMail_regex,[report_errors,global]), ok. -re_backwards_accented(doc) -> - "Check for nasty bug where accented graphemes can make PCRE back past " - "beginning of subject"; + +%% Check for nasty bug where accented graphemes can make PCRE back +%% past beginning of subject. re_backwards_accented(Config) when is_list(Config) -> ?line match = re:run(<<65,204,128,65,204,128,97,98,99>>, <<"\\X?abc">>, [unicode,{capture,none}]), ok. -opt_dupnames(doc) -> - "Check correct handling of dupnames option to re"; + +%% Check correct handling of dupnames option to re. opt_dupnames(Config) when is_list(Config) -> Days = ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"], _ = [ begin @@ -739,8 +727,7 @@ opt_dupnames(Config) when is_list(Config) -> "h","a","n","T","e","then"],binary}]), ok. -opt_all_names(doc) -> - "Test capturing of all_names"; +%% Test capturing of all_names. opt_all_names(Config) when is_list(Config) -> Days = ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"], {match,[{1,3},{0,1},{7,1}]} = re:run("SMondayX","(?<Skrap>.)(?<DN>Mon|Fri|Sun)(?:day)?(?<Skrap2>.)|" @@ -812,8 +799,7 @@ opt_all_names(Config) when is_list(Config) -> [dupnames,{capture,all_names,binary}]), ok. -inspect(doc) -> - "Test the minimal inspect function"; +%% Test the minimal inspect function. inspect(Config) when is_list(Config)-> {ok,MP} = re:compile("(?<A>A)|(?<B>B)|(?<C>C)."), {namelist,[<<"A">>,<<"B">>,<<"C">>]} = re:inspect(MP,namelist), @@ -826,15 +812,13 @@ inspect(Config) when is_list(Config)-> {'EXIT',{badarg,_}} = (catch re:inspect({re_pattern,3,0,0,<<"kalle",2:2>>},namelist)), ok. -opt_no_start_optimize(doc) -> - "Test that the no_start_optimize compilation flag works"; +%% Test that the no_start_optimize compilation flag works. opt_no_start_optimize(Config) when is_list(Config) -> {match, [{3,3}]} = re:run("DEFABC","(*COMMIT)ABC",[]), % Start optimization makes this result wrong! nomatch = re:run("DEFABC","(*COMMIT)ABC",[no_start_optimize]), % This is the correct result... ok. -opt_never_utf(doc) -> - "Check that the never_utf option works"; +%% Check that the never_utf option works. opt_never_utf(Config) when is_list(Config) -> {match,[{0,3}]} = re:run("ABC","ABC",[never_utf]), {match,[{0,3}]} = re:run("ABC","(*UTF)ABC",[]), @@ -848,8 +832,8 @@ opt_never_utf(Config) when is_list(Config) -> {error,_} = (catch re:compile("(*UTF)ABC",[never_utf])), {error,_} = (catch re:compile("(*UTF8)ABC",[never_utf])), ok. -opt_ucp(doc) -> - "Check that the ucp option is passed to PCRE"; + +%% Check that the ucp option is passed to PCRE. opt_ucp(Config) when is_list(Config) -> {match,[{0,1}]} = re:run([$a],"\\w",[unicode]), {match,[{0,2}]} = re:run([229],"\\w",[unicode]), % Latin1 works without UCP, as we have a default @@ -857,8 +841,8 @@ opt_ucp(Config) when is_list(Config) -> nomatch = re:run([1024],"\\w",[unicode]), % Latin1 word characters only, 1024 is not latin1 {match,[{0,2}]} = re:run([1024],"\\w",[unicode,ucp]), % Any Unicode word character works with 'ucp' ok. -match_limit(doc) -> - "Check that the match_limit and match_limit_recursion options work"; + +%% Check that the match_limit and match_limit_recursion options work. match_limit(Config) when is_list(Config) -> nomatch = re:run("aaaaaaaaaaaaaz","(a+)*zz",[]), nomatch = re:run("aaaaaaaaaaaaaz","(a+)*zz",[{match_limit,3000}]), @@ -893,9 +877,8 @@ match_limit(Config) when is_list(Config) -> [{match_limit,-1}, report_errors,global])), ok. -sub_binaries(doc) -> - "test that we get sub-binaries if subject is a binary and we " - "capture binaries"; +%% 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}]), |