update: add load

This commit is contained in:
Lucas F. 2026-01-03 20:13:59 -03:00
parent 510dec9113
commit bbab647430
3 changed files with 88 additions and 11 deletions

View file

@ -609,3 +609,37 @@ test "parse firstof com fallback" {
try testing.expectEqualStrings("var2", fo.values[1]);
try testing.expectEqualStrings("Nenhum valor", fo.values[2]);
}
test "parse load simples" {
const allocator = testing.allocator;
const template = "{% load i18n humanize %}";
const nodes = try parser.parse(allocator, template);
defer {
for (nodes) |node| node.deinit(allocator);
allocator.free(nodes);
}
try testing.expectEqual(@as(usize, 1), nodes.len);
try testing.expect(nodes[0].type == .load);
const l = nodes[0].load.?;
try testing.expectEqual(@as(usize, 2), l.libraries.len);
try testing.expectEqualStrings("i18n", l.libraries[0]);
try testing.expectEqualStrings("humanize", l.libraries[1]);
}
test "parse load com múltiplas" {
const allocator = testing.allocator;
const template = "{% load admin_urls static %}";
const nodes = try parser.parse(allocator, template);
defer {
for (nodes) |node| node.deinit(allocator);
allocator.free(nodes);
}
try testing.expectEqual(@as(usize, 1), nodes.len);
try testing.expect(nodes[0].type == .load);
const l = nodes[0].load.?;
try testing.expectEqual(@as(usize, 2), l.libraries.len);
try testing.expectEqualStrings("admin_urls", l.libraries[0]);
try testing.expectEqualStrings("static", l.libraries[1]);
}