aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/test
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2011-12-03 17:09:22 +0100
committerAnders Svensson <[email protected]>2011-12-04 17:47:46 +0100
commitc69639c5bec4d0e41af43ea272a70dcf1fc04e64 (patch)
tree96809293cce43a910297b392b7060340138a376c /lib/diameter/test
parent337102b0220929f1f0b65302021ddead68292db4 (diff)
downloadotp-c69639c5bec4d0e41af43ea272a70dcf1fc04e64.tar.gz
otp-c69639c5bec4d0e41af43ea272a70dcf1fc04e64.tar.bz2
otp-c69639c5bec4d0e41af43ea272a70dcf1fc04e64.zip
Add format testcase to compiler suite
Plus additional parsing tests.
Diffstat (limited to 'lib/diameter/test')
-rw-r--r--lib/diameter/test/diameter_compiler_SUITE.erl20
1 files changed, 18 insertions, 2 deletions
diff --git a/lib/diameter/test/diameter_compiler_SUITE.erl b/lib/diameter/test/diameter_compiler_SUITE.erl
index 7caea3258e..c4de6e4f85 100644
--- a/lib/diameter/test/diameter_compiler_SUITE.erl
+++ b/lib/diameter/test/diameter_compiler_SUITE.erl
@@ -31,6 +31,7 @@
%% testcases
-export([base/1,
+ format/1,
replace/1, replace/2]).
-export([dict/0]). %% fake dictionary module
@@ -49,6 +50,9 @@
[{scan,
"@id 0",
"@id \\&"},
+ {scan,
+ "@name ",
+ "&'"},
{parse,
"@id 0",
"@id @id"},
@@ -151,6 +155,9 @@
{requested_avp_not_found,
[{"@id", "@inherits diameter_gen_base_rfc3588 XXX &"},
{"CEA ::=", "<XXX> &"}]},
+ {requested_avp_not_found,
+ [{"@id", "@inherits diameter_gen_base_rfc3588 'X X X' &"},
+ {"CEA ::=", "<'X X X'> &"}]},
{enumerated_avp_has_wrong_local_type,
"Enumerated",
"Time"},
@@ -176,11 +183,12 @@
"@avp_types",
"& bad syntax"},
{ok,
- [{"^ *Class .*", "@avp_types"},
+ [{"@avp_types", "& 3XXX 666 Time M 'X X X' 667 Time -"},
+ {"^ *Class .*", "@avp_types"},
{"^ *Failed-AVP ", "@avp_types &"},
{"@grouped", "&&"},
{"^ *Failed-AVP ::=", "@grouped &"},
- {"CEA ::=", "<Class> &"},
+ {"CEA ::=", "<'Class'> &"},
{"@avp_types", "@inherits diameter_gen_base_rfc3588 Class\n&"},
{"@avp_types", "@custom_types mymod "
"Product-Name Firmware-Revision\n"
@@ -194,6 +202,7 @@ suite() ->
all() ->
[base,
+ format,
replace].
%% Error handling testcases will make an erroneous dictionary out of
@@ -220,6 +229,13 @@ base(_Config) ->
"diameter_gen_base_rfc3588"]),
{module, _} = code:load_abs(Base).
+%% Ensure that parse o format is the identity map.
+format(Config) ->
+ Bin = proplists:get_value(base, Config),
+ {ok, Dict} = diameter_dict_util:parse(Bin, []),
+ {ok, D} = diameter_dict_util:parse(diameter_dict_util:format(Dict), []),
+ {Dict, Dict} = {Dict, D}.
+
%% replace/1
replace(Config) ->