mirror of
https://github.com/alexhopeoconnor/DFTE.git
synced 2026-10-17 05:41:30 +10:00
Harden DFTE rendering and placeholder registration to fail safely under stalled and invalid inputs.
Add regression coverage and docs updates so these edge cases stay stable across board test runs.
This commit is contained in:
@@ -26,8 +26,18 @@ void test_edge_cases_error_handling() {
|
||||
TemplateContext ctx;
|
||||
ctx.setRegistry(®istry);
|
||||
|
||||
// Test render with null template pointer (should handle gracefully)
|
||||
// Note: initializeContext expects valid PROGMEM pointer, so we'll test with empty template
|
||||
// Test render with null template pointer (should enter error cleanly)
|
||||
TemplateRenderer::initializeContext(ctx, nullptr, false);
|
||||
TEST_ASSERT_TRUE_MESSAGE(ctx.hasError(),
|
||||
"Null template pointer should set context to error");
|
||||
uint8_t nullBuffer[8];
|
||||
size_t nullWritten = TemplateRenderer::renderNextChunk(ctx, nullBuffer, sizeof(nullBuffer));
|
||||
TEST_ASSERT_EQUAL_UINT32_MESSAGE(0u, static_cast<uint32_t>(nullWritten),
|
||||
"Null template render should produce no output");
|
||||
|
||||
// Test render with empty template
|
||||
ctx.reset();
|
||||
ctx.setRegistry(®istry);
|
||||
TemplateRenderer::initializeContext(ctx, empty_template);
|
||||
String result1 = captureRenderedOutput(ctx);
|
||||
TEST_ASSERT_EQUAL_STRING_MESSAGE("", result1.c_str(),
|
||||
|
||||
Reference in New Issue
Block a user