update: now
This commit is contained in:
parent
36cc1caac0
commit
1888c5e07a
2 changed files with 37 additions and 0 deletions
|
|
@ -635,3 +635,33 @@ test "renderer - widthratio inside block" {
|
|||
try testing.expect(std.mem.indexOf(u8, output, "Conteúdo padrão") != null);
|
||||
try testing.expect(std.mem.indexOf(u8, output, "Conteúdo do filho") != null);
|
||||
}
|
||||
|
||||
test "renderer - now" {
|
||||
std.debug.print("____________________________________________________\n", .{});
|
||||
std.debug.print("15 - render now\n", .{});
|
||||
|
||||
const alloc = testing.allocator;
|
||||
var ctx = Context.init(alloc);
|
||||
defer ctx.deinit();
|
||||
|
||||
var cache = TemplateCache.init(alloc);
|
||||
defer cache.deinit();
|
||||
|
||||
const renderer = Renderer.init(&ctx, &cache);
|
||||
|
||||
try ctx.set("idade", Value{ .int = 20 });
|
||||
|
||||
const template =
|
||||
// \\{% now \"Y-m-d H:i:s\" %}
|
||||
\\{% now %}
|
||||
;
|
||||
|
||||
var buf = std.ArrayList(u8){};
|
||||
defer buf.deinit(alloc);
|
||||
|
||||
try renderer.renderString(template, buf.writer(alloc));
|
||||
|
||||
std.debug.print("OUTPUT:\n\n{s}\n", .{buf.items});
|
||||
|
||||
// try testing.expect(std.mem.indexOf(u8, buf.items, "Maior") != null);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue