feat: add include demo page to showcase include directive
- Add includes/some_partial.pug partial in demo views - Add pages/include-demo.pug page using include directive - Add /include-demo route in demo server - Add link to include demo in about page - Fix test_includes.zig path in build.zig - Add test_views for include testing
This commit is contained in:
@@ -6,6 +6,7 @@ pub fn main() !void {
|
||||
defer _ = gpa.deinit();
|
||||
const allocator = gpa.allocator();
|
||||
|
||||
// Test: Simple include from test_views
|
||||
var engine = pugz.ViewEngine.init(allocator, .{
|
||||
.views_dir = "test_views",
|
||||
}) catch |err| {
|
||||
@@ -21,4 +22,14 @@ pub fn main() !void {
|
||||
defer allocator.free(html);
|
||||
|
||||
std.debug.print("=== Rendered HTML ===\n{s}\n=== End ===\n", .{html});
|
||||
|
||||
// Verify output contains included content
|
||||
if (std.mem.indexOf(u8, html, "Included Partial") != null and
|
||||
std.mem.indexOf(u8, html, "info-box") != null)
|
||||
{
|
||||
std.debug.print("\nSUCCESS: Include directive works correctly!\n", .{});
|
||||
} else {
|
||||
std.debug.print("\nFAILURE: Include content not found!\n", .{});
|
||||
return error.TestFailed;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user