X-Git-Url: http://sru.miketaylor.org.uk/?a=blobdiff_plain;f=src%2Ftest_html_parser.cpp;h=370ff725354d1d9b31c21a78a08347332b1bd2df;hb=dd17e564b39fa38a3d611853a3b13dacdff3d070;hp=baf42bc86d9e39a92155cecc204debbd2e5a9714;hpb=61a563ec4484df103182afd0b5f49e1f91d3454d;p=metaproxy-moved-to-github.git diff --git a/src/test_html_parser.cpp b/src/test_html_parser.cpp index baf42bc..370ff72 100644 --- a/src/test_html_parser.cpp +++ b/src/test_html_parser.cpp @@ -49,10 +49,13 @@ public: const char *value, int val_len, const char *sep) { out += " "; out.append(attr, attr_len); - out += "="; - out += sep; - out.append(value, val_len); - out += sep; + if (value) + { + out += "="; + out += sep; + out.append(value, val_len); + out += sep; + } } void anyTagEnd(const char *tag, int tag_len, int close_it) { if (close_it) @@ -105,7 +108,7 @@ BOOST_AUTO_TEST_CASE( test_html_parser_2 ) try { mp::HTMLParser hp; - const char* html = + const char* html = "\n" "\n" "
\n" @@ -132,7 +135,7 @@ BOOST_AUTO_TEST_CASE( test_html_parser_2 ) std::cout << e.out << std::endl; } } - catch (std::exception & e) + catch (std::exception & e) { std::cout << e.what(); std::cout << std::endl; @@ -169,7 +172,7 @@ BOOST_AUTO_TEST_CASE( test_html_parser_3 ) std::cout << e.out << std::endl; } } - catch (std::exception & e) + catch (std::exception & e) { std::cout << e.what(); std::cout << std::endl; @@ -183,12 +186,42 @@ BOOST_AUTO_TEST_CASE( test_html_parser_4 ) { mp::HTMLParser hp; const char* html = - "<\"?xml version=\"1.0\" strandalone=\"no\"? ax>\n" - "