X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Ftest_html_parser.cpp;h=5ba7e5a29b39478ce52af1b63b71c1c00b8552e6;hb=586d78659d671683f33ec55f4a7d32b28e345ccd;hp=360443632d85e383e73e19112774d1deb5667619;hpb=b8f4ac1af9456465a24ecd338fd998e292030abf;p=metaproxy-moved-to-github.git diff --git a/src/test_html_parser.cpp b/src/test_html_parser.cpp index 3604436..5ba7e5a 100644 --- a/src/test_html_parser.cpp +++ b/src/test_html_parser.cpp @@ -1,5 +1,5 @@ /* This file is part of Metaproxy. - Copyright (C) 2005-2013 Index Data + Copyright (C) Index Data Metaproxy is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free @@ -241,6 +241,68 @@ BOOST_AUTO_TEST_CASE( test_html_parser_5 ) } } +BOOST_AUTO_TEST_CASE( test_html_parser_6 ) +{ + try + { + mp::HTMLParser hp; + const char* html = + ""; + + const char* expected = html; + MyEvent e; + hp.set_verbose(0); + hp.parse(e, html); + + BOOST_CHECK_EQUAL(std::string(expected), e.out); + if (std::string(expected) != e.out) + { + std::cout << "Expected" << std::endl; + std::cout << expected << std::endl; + std::cout << "Got" << std::endl; + std::cout << e.out << std::endl; + } + } + catch (std::exception & e) + { + std::cout << e.what(); + std::cout << std::endl; + BOOST_CHECK (false); + } +} + +BOOST_AUTO_TEST_CASE( test_html_parser_7 ) +{ + try + { + mp::HTMLParser hp; + const char* html = + "" + "\nx=2;\n"; + + const char* expected = html; + MyEvent e; + hp.set_verbose(0); + hp.parse(e, html); + + BOOST_CHECK_EQUAL(std::string(expected), e.out); + if (std::string(expected) != e.out) + { + std::cout << "Expected" << std::endl; + std::cout << expected << std::endl; + std::cout << "Got" << std::endl; + std::cout << e.out << std::endl; + } + } + catch (std::exception & e) + { + std::cout << e.what(); + std::cout << std::endl; + BOOST_CHECK (false); + } +} + /* * Local variables: