Skip to content

Commit

Permalink
Testing.
Browse files Browse the repository at this point in the history
  • Loading branch information
igormironchik committed Nov 7, 2017
1 parent 543577f commit 180271d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 29 deletions.
3 changes: 3 additions & 0 deletions cfgfile/parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,9 @@ class parser_dom_impl_t final
}
else
{
if( !n.toComment().isNull() )
continue;

QDomText text = n.toText();

if( !text.isNull() )
Expand Down
29 changes: 0 additions & 29 deletions tests/auto/QtParser/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,35 +129,6 @@ TEST( QtParser, test_cant_set_xml )
}
}

TEST( QtParser, test_unexpected_xml )
{
cfgfile::tag_no_value_t< cfgfile::qstring_trait_t > tag( "cfg", true );

QDomDocument doc;

QDomElement cfg = doc.createElement( "cfg" );

doc.appendChild( cfg );

QDomComment c = doc.createComment( "data" );

cfg.appendChild( c );

cfgfile::parser_t< cfgfile::qstring_trait_t > parser( tag, doc );

try {
parser.parse( "test_unexpected_xml" );

CHECK_CONDITION( false )
}
catch( const cfgfile::exception_t< cfgfile::qstring_trait_t > & x )
{
CHECK_CONDITION( x.desc() == "Unexpected tag name. "
"We expected one child tag of tag \"cfg\", but we've got \"#comment\". "
"In file \"test_unexpected_xml\" on line -1." )
}
}

int main()
{
RUN_ALL_TESTS()
Expand Down

0 comments on commit 180271d

Please sign in to comment.