diff options
Diffstat (limited to 'lib/xmerl/test/xmerl_sax_SUITE.erl')
-rw-r--r-- | lib/xmerl/test/xmerl_sax_SUITE.erl | 81 |
1 files changed, 21 insertions, 60 deletions
diff --git a/lib/xmerl/test/xmerl_sax_SUITE.erl b/lib/xmerl/test/xmerl_sax_SUITE.erl index 590ae14e23..f5c0a783c4 100644 --- a/lib/xmerl/test/xmerl_sax_SUITE.erl +++ b/lib/xmerl/test/xmerl_sax_SUITE.erl @@ -38,25 +38,11 @@ %% Initializations %%---------------------------------------------------------------------- -init_per_suite(doc) -> - ["Starts the test suite"]; -init_per_suite(Config) -> - Config. - -end_per_suite(doc) -> - ["Stops the test suite"]; -end_per_suite(Config) -> - Config. - +all() -> + [{group, bugs}]. - -%% initialization before each testcase -init_per_testcase(_TestCase,Config) -> - Config. - -%% clean up after each testcase -end_per_testcase(_Func,_Config) -> - ok. +groups() -> + [{bugs, [], [ticket_8213, ticket_8214, ticket_11551]}]. %%---------------------------------------------------------------------- %% Tests @@ -66,9 +52,8 @@ end_per_testcase(_Func,_Config) -> %% Test Case %% ID: ticket_8213 %% Description: Checks that end of document is checked properly when continuation fun is missing. -ticket_8213(suite) -> []; ticket_8213(_Config) -> - ?line {ok,ok,[]} = xmerl_sax_parser:stream("<elem/>", [{event_fun, fun (_E,_,_) -> ok end}]), + {ok,ok,[]} = xmerl_sax_parser:stream("<elem/>", [{event_fun, fun (_E,_,_) -> ok end}]), ok. @@ -76,65 +61,41 @@ ticket_8213(_Config) -> %% Test Case %% ID: ticket_8214 %% Description: Checks that attributes with default namespace don't get [] in NS field. -ticket_8214(suite) -> []; ticket_8214(_Config) -> - ?line {ok,ok,[]} = - xmerl_sax_parser:stream("<elem attr='123' x:attr='234' xmlns='http://lshift.net/d' " - "xmlns:x='http://lshift.net/x' />", - [{event_fun, fun ({startElement,"http://lshift.net/d","elem", - {[],"elem"}, - [{[],[],"attr","123"},{"http://lshift.net/x","x","attr","234"}]}, - _, _) ->ok; - ({startElement, _, "elem",_,_}, _,_) -> - throw({test, "Error in startElement tuple"}); - (_E,_,_) -> ok - end}]), + Event = fun ({startElement,"http://lshift.net/d","elem", + {[],"elem"}, + [{[],[],"attr","123"},{"http://lshift.net/x","x","attr","234"}]}, + _, _) ->ok; + ({startElement, _, "elem",_,_}, _,_) -> + throw({test, "Error in startElement tuple"}); + (_E,_,_) -> ok + end, + + {ok,ok,[]} = xmerl_sax_parser:stream("<elem attr='123' x:attr='234' xmlns='http://lshift.net/d' " + "xmlns:x='http://lshift.net/x' />", + [{event_fun, Event}]), ok. %%---------------------------------------------------------------------- %% Test Case %% ID: ticket_8214 %% Description: Checks that attributes with default namespace don't get [] in NS field. -ticket_11551(suite) -> []; -ticket_11551(Config) -> +ticket_11551(_Config) -> Stream1 = <<"<?xml version=\"1.0\" encoding=\"utf-8\" ?> <a>hej</a> <?xml version=\"1.0\" encoding=\"utf-8\" ?> <a>hej</a>">>, - ?line {ok, undefined, <<"<?xml", _/binary>>} = xmerl_sax_parser:stream(Stream1, []), + {ok, undefined, <<"<?xml", _/binary>>} = xmerl_sax_parser:stream(Stream1, []), Stream2= <<"<?xml version=\"1.0\" encoding=\"utf-8\" ?> <a>hej</a> <?xml version=\"1.0\" encoding=\"utf-8\" ?> <a>hej</a>">>, - ?line {ok, undefined, <<"<?xml", _/binary>>} = xmerl_sax_parser:stream(Stream2, []), + {ok, undefined, <<"<?xml", _/binary>>} = xmerl_sax_parser:stream(Stream2, []), Stream3= <<"<a>hej</a> <?xml version=\"1.0\" encoding=\"utf-8\" ?> <a>hej</a>">>, - ?line {ok, undefined, <<"<?xml", _/binary>>} = xmerl_sax_parser:stream(Stream3, []), + {ok, undefined, <<"<?xml", _/binary>>} = xmerl_sax_parser:stream(Stream3, []), ok. - - - -%%---------------------------------------------------------------------- -%% Bug test cases -%% - -%%---------------------------------------------------------------------- -%% Test Suite -%% -all() -> - [{group, bugs}]. - -groups() -> - [{bugs, [], [ticket_8213, ticket_8214, ticket_11551]}]. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - |