aboutsummaryrefslogtreecommitdiffstats
path: root/lib/erl_interface/test/all_SUITE_data
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2011-08-26 10:09:27 +0200
committerBjörn Gustavsson <[email protected]>2011-10-27 12:26:49 +0200
commit69542150b2863a2b715e03682539ec68402cb0ff (patch)
treed726f3a87b38bfc32cb07342b8e7efce74b60654 /lib/erl_interface/test/all_SUITE_data
parent3077842ea7098c51b0b0e5b4fad88fbe5e8e29a6 (diff)
downloadotp-69542150b2863a2b715e03682539ec68402cb0ff.tar.gz
otp-69542150b2863a2b715e03682539ec68402cb0ff.tar.bz2
otp-69542150b2863a2b715e03682539ec68402cb0ff.zip
erl_interface tests: Eliminate use of deprecated regexp module
Diffstat (limited to 'lib/erl_interface/test/all_SUITE_data')
-rw-r--r--lib/erl_interface/test/all_SUITE_data/init_tc.erl18
1 files changed, 3 insertions, 15 deletions
diff --git a/lib/erl_interface/test/all_SUITE_data/init_tc.erl b/lib/erl_interface/test/all_SUITE_data/init_tc.erl
index 8157d590fc..8db4667bf9 100644
--- a/lib/erl_interface/test/all_SUITE_data/init_tc.erl
+++ b/lib/erl_interface/test/all_SUITE_data/init_tc.erl
@@ -40,23 +40,11 @@ run([]) ->
run1(Name) ->
CFile = Name ++ ".c",
{ok, Bin} = file:read_file(CFile),
- String = binary_to_list(Bin),
-
- %% This ConstPart stuff is because you can't retrieve part of a match.
- %% Long live Perl!
-
- ConstPart = "\nTESTCASE\\(",
- ConstPartLen = 10,
- {match, Matches} = regexp:matches(String, ConstPart++"[_a-zA-Z]*"),
- Cases = get_names(Matches, ConstPartLen, Bin, []),
+ RE = "\nTESTCASE\\(([_a-zA-Z]*)\\)",
+ {match, Cases0} = re:run(Bin, RE, [{capture,all_but_first,list},global]),
+ Cases = lists:concat(Cases0),
generate(Name, Cases).
-get_names([{Start, Length}|Rest], Skip, Bin, Result) ->
- Name = binary_to_list(Bin, Start+Skip, Start+Length-1),
- get_names(Rest, Skip, Bin, [Name|Result]);
-get_names([], _Skip, _Bin, Result) ->
- lists:reverse(Result).
-
generate(TcName, Cases) ->
Hrl = TcName ++ "_cases.hrl",
{ok, HrlFile} = file:open(Hrl, write),