From 180271dedd9677f0094fcdbe00dc0c80eca8f52d Mon Sep 17 00:00:00 2001 From: Igor Mironchik Date: Tue, 7 Nov 2017 12:09:37 +0300 Subject: [PATCH] Testing. --- cfgfile/parser.hpp | 3 +++ tests/auto/QtParser/main.cpp | 29 ----------------------------- 2 files changed, 3 insertions(+), 29 deletions(-) diff --git a/cfgfile/parser.hpp b/cfgfile/parser.hpp index 552f4b8..ac2ba9a 100644 --- a/cfgfile/parser.hpp +++ b/cfgfile/parser.hpp @@ -420,6 +420,9 @@ class parser_dom_impl_t final } else { + if( !n.toComment().isNull() ) + continue; + QDomText text = n.toText(); if( !text.isNull() ) diff --git a/tests/auto/QtParser/main.cpp b/tests/auto/QtParser/main.cpp index 4a9e4cf..9302061 100644 --- a/tests/auto/QtParser/main.cpp +++ b/tests/auto/QtParser/main.cpp @@ -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()