aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnders Svensson <anders@erlang.org>2013-09-23 14:21:41 +0200
committerAnders Svensson <anders@erlang.org>2013-11-28 17:27:28 +0100
commit742e83daafafd95b31643f9f2a702da725e1ec18 (patch)
treee8fa307f2c6061d0521e34f05e78f14c36d070b6
parent5313da9fc31e14b7b676b8c24a539256a551ebb7 (diff)
downloadotp-742e83daafafd95b31643f9f2a702da725e1ec18.tar.gz
otp-742e83daafafd95b31643f9f2a702da725e1ec18.tar.bz2
otp-742e83daafafd95b31643f9f2a702da725e1ec18.zip
Adapt compiler suite to diameter_make
It was originally written before this interface existed.
-rw-r--r--lib/diameter/test/diameter_compiler_SUITE.erl26
1 files changed, 14 insertions, 12 deletions
diff --git a/lib/diameter/test/diameter_compiler_SUITE.erl b/lib/diameter/test/diameter_compiler_SUITE.erl
index 40d0bf7c63..66c671b52d 100644
--- a/lib/diameter/test/diameter_compiler_SUITE.erl
+++ b/lib/diameter/test/diameter_compiler_SUITE.erl
@@ -45,7 +45,7 @@
%% RE/Replacement (in the sense of re:replace/4) pairs for morphing
%% base_rfc3588.dia. The key is 'ok' or the the expected error as
%% returned in the first element of the error tuple returned by
-%% diameter_dict_util:parse/2.
+%% diameter_make:codec/2.
-define(REPLACE,
[{ok,
"",
@@ -361,10 +361,18 @@ format(Config) ->
format(Mods, Bin) ->
B = modify(Bin, Mods),
- {ok, Dict} = diameter_dict_util:parse(B, []),
- {ok, D} = diameter_dict_util:parse(diameter_dict_util:format(Dict), []),
+ {ok, Dict} = make(B, []),
+ {ok, D} = make(diameter_make:format(Dict), []),
{Dict, Dict} = {Dict, D}.
+make(File, Opts) ->
+ case diameter_make:codec(File, [return, debug | Opts]) of
+ {ok, [_E,_H,_F,[_Vsn|Dict]]} ->
+ {ok, Dict};
+ {error, _} = E ->
+ E
+ end.
+
%% ===========================================================================
%% replace/1
%%
@@ -379,13 +387,10 @@ replace(Config) ->
replace({E, Mods}, Bin) ->
B = modify(Bin, Mods),
- case {E, diameter_dict_util:parse(B, [{include, here()}]), Mods} of
+ case {E, make(B, [{include, here()}]), Mods} of
{ok, {ok, Dict}, _} ->
Dict;
- {_, {error, {E,_} = T}, _} ->
- S = diameter_dict_util:format_error(T),
- true = nochar($", S, E),
- true = nochar($', S, E),
+ {_, {error, S}, _} ->
S
end.
@@ -407,7 +412,7 @@ generate(Config) ->
generate(Mods, Bin, N, Mode) ->
B = modify(Bin, Mods ++ [{"@name .*", "@name dict" ++ ?L(N)}]),
- {ok, Dict} = diameter_dict_util:parse(B, []),
+ {ok, Dict} = make(B, []),
File = "dict" ++ integer_to_list(N),
{_, ok} = {Dict, diameter_codegen:from_dict("dict",
Dict,
@@ -428,9 +433,6 @@ norm({E, RE, Repl}) ->
norm({_,_} = T) ->
T.
-nochar(Char, Str, Err) ->
- Err == parse orelse not lists:member(Char, Str) orelse Str.
-
here() ->
filename:dirname(code:which(?MODULE)).