| 29 | }; |
| 30 | |
| 31 | void test_xml_parser(void) |
| 32 | { |
| 33 | FILE *fp = fopen("fixtures/test.html", "rb"); |
| 34 | TEST_ASSERT_NOT_NULL_MESSAGE(fp, "Failed to open test.html"); |
| 35 | fseek(fp, 0, SEEK_END); |
| 36 | long fsize = ftell(fp); |
| 37 | fseek(fp, 0, SEEK_SET); //same as rewind(f); |
| 38 | |
| 39 | char *html = (char *)malloc(fsize + 1); |
| 40 | fread(html, fsize, 1, fp); |
| 41 | html[fsize] = 0; |
| 42 | |
| 43 | tinyxml2::XMLDocument doc(false, tinyxml2::COLLAPSE_WHITESPACE); |
| 44 | auto result = doc.Parse(html); |
| 45 | TEST_ASSERT_EQUAL(tinyxml2::XML_SUCCESS, result); |
| 46 | auto body = doc.FirstChildElement("html")->FirstChildElement("body"); |
| 47 | TEST_ASSERT_NOT_NULL_MESSAGE(body, "Body element not found"); |
| 48 | body->Accept(new MyVisitor()); |
| 49 | } |
nothing calls this directly
no outgoing calls
no test coverage detected