Release Readt
Some checks failed
CI / build-linux-and-wasm (x64-linux) (push) Has been cancelled

This commit is contained in:
2026-01-25 22:08:16 +05:30
parent 601b573983
commit ebde7c7e66
19 changed files with 51 additions and 567 deletions

View File

@ -21,9 +21,6 @@ using namespace IACore;
IAT_BEGIN_BLOCK(Core, XML)
// -------------------------------------------------------------------------
// 1. Basic String Parsing
// -------------------------------------------------------------------------
auto test_parse_string() -> bool {
const String xml_content = R"(
<root>
@ -50,9 +47,6 @@ auto test_parse_string() -> bool {
return true;
}
// -------------------------------------------------------------------------
// 2. Error Handling
// -------------------------------------------------------------------------
auto test_parse_error() -> bool {
const String invalid_xml = "<root><unclosed>";
auto res = XML::parse_from_string(invalid_xml);
@ -60,9 +54,6 @@ auto test_parse_error() -> bool {
return true;
}
// -------------------------------------------------------------------------
// 3. Serialization
// -------------------------------------------------------------------------
auto test_serialize() -> bool {
const String xml_content = "<root><node>Text</node></root>";
auto res = XML::parse_from_string(xml_content);
@ -70,21 +61,16 @@ auto test_serialize() -> bool {
String output = XML::serialize_to_string(*res);
// Basic containment check as formatting might vary
IAT_CHECK(output.find("<root>") != String::npos);
IAT_CHECK(output.find("<node>Text</node>") != String::npos);
return true;
}
// -------------------------------------------------------------------------
// 4. String Escaping
// -------------------------------------------------------------------------
auto test_escape() -> bool {
const String raw = "< & > \" '";
const String escaped = XML::escape_xml_string(raw);
// Check for standard XML entities
IAT_CHECK(escaped.find("&lt;") != String::npos);
IAT_CHECK(escaped.find("&amp;") != String::npos);
IAT_CHECK(escaped.find("&gt;") != String::npos);
@ -94,18 +80,13 @@ auto test_escape() -> bool {
return true;
}
// -------------------------------------------------------------------------
// 5. File I/O Integration
// -------------------------------------------------------------------------
auto test_file_io() -> bool {
const Path path = "test_temp_xml_doc.xml";
const String content = "<config><ver>1.0</ver></config>";
// 1. Write Test File
auto write_res = FileOps::write_text_file(path, content, true);
IAT_CHECK(write_res.has_value());
// 2. Parse from File
auto parse_res = XML::parse_from_file(path);
IAT_CHECK(parse_res.has_value());
@ -113,15 +94,11 @@ auto test_file_io() -> bool {
IAT_CHECK_EQ(String(doc.child("config").child("ver").child_value()),
String("1.0"));
// 3. Cleanup
std::filesystem::remove(path);
return true;
}
// -------------------------------------------------------------------------
// Registration
// -------------------------------------------------------------------------
IAT_BEGIN_TEST_LIST()
IAT_ADD_TEST(test_parse_string);
IAT_ADD_TEST(test_parse_error);