diff options
author | Patrik Nyblom <[email protected]> | 2010-01-16 12:12:46 +0000 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2010-01-27 12:27:35 +0100 |
commit | 1d2a481cfd016f204183b44d8f95798161b423e3 (patch) | |
tree | b5fc6cfbf2b3e12c0f45cbb9b2118bb2802af252 /lib/stdlib | |
parent | 98cb178fe80be7ee560c16e02dc31bf3df7700c8 (diff) | |
download | otp-1d2a481cfd016f204183b44d8f95798161b423e3.tar.gz otp-1d2a481cfd016f204183b44d8f95798161b423e3.tar.bz2 otp-1d2a481cfd016f204183b44d8f95798161b423e3.zip |
Fix re:replace/4 to handle unicode charlist RE argument
The real problem is in the re:run/3 BIF.
Noticed-by: Rory Byrne
Tests-by: Rory Byrne
Diffstat (limited to 'lib/stdlib')
-rw-r--r-- | lib/stdlib/test/re_SUITE.erl | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/stdlib/test/re_SUITE.erl b/lib/stdlib/test/re_SUITE.erl index a9c9afea94..f8667bfcee 100644 --- a/lib/stdlib/test/re_SUITE.erl +++ b/lib/stdlib/test/re_SUITE.erl @@ -18,12 +18,12 @@ %% -module(re_SUITE). --export([all/1, pcre/1,compile_options/1,run_options/1,combined_options/1,replace_autogen/1,global_capture/1,replace_return/1,split_autogen/1,split_options/1,split_specials/1,error_handling/1]). +-export([all/1, pcre/1,compile_options/1,run_options/1,combined_options/1,replace_autogen/1,global_capture/1,replace_input_types/1,replace_return/1,split_autogen/1,split_options/1,split_specials/1,error_handling/1]). -include("test_server.hrl"). -include_lib("kernel/include/file.hrl"). -all(suite) -> [pcre,compile_options,run_options,combined_options,replace_autogen,global_capture,replace_return,split_autogen,split_options,split_specials,error_handling]. +all(suite) -> [pcre,compile_options,run_options,combined_options,replace_autogen,global_capture,replace_input_types,replace_return,split_autogen,split_options,split_specials,error_handling]. pcre(doc) -> ["Run all applicable tests from the PCRE testsuites."]; @@ -268,7 +268,16 @@ 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]), ?t:timetrap_cancel(Dog), ok. - + +replace_input_types(doc) -> + ["Tests replace with different input types"]; +replace_input_types(Config) when is_list(Config) -> + Dog = ?t:timetrap(?t:minutes(3)), + ?line <<"abcd">> = re:replace("abcd","Z","X",[{return,binary},unicode]), + ?line <<"abcd">> = re:replace("abcd","\x{400}","X",[{return,binary},unicode]), + ?t:timetrap_cancel(Dog), + ok. + replace_return(doc) -> ["Tests return options of replace together with global searching"]; replace_return(Config) when is_list(Config) -> |