update: test for something inside block
This commit is contained in:
parent
7c53a272a7
commit
1ab6291116
1 changed files with 9 additions and 19 deletions
|
|
@ -247,7 +247,6 @@ test "parse comment" {
|
|||
try testing.expectEqualStrings("Bazinga! ", nodes[0].text.?.content);
|
||||
}
|
||||
|
||||
// FIX: check parse block something is wrong
|
||||
test "parse comment inside block" {
|
||||
std.debug.print("____________________________________________________\n", .{});
|
||||
std.debug.print("12 - parse comment\n", .{});
|
||||
|
|
@ -263,17 +262,15 @@ test "parse comment inside block" {
|
|||
|
||||
try testing.expectEqual(@as(usize, 1), nodes.len);
|
||||
try testing.expect(nodes[0].type == .tag);
|
||||
// try testing.expectEqual(@as(usize,2), nodes[0].tag.?.body.block.body.len);
|
||||
//
|
||||
|
||||
// const b = nodes[0].tag.?.body.block.body;
|
||||
// for (b) |node| {
|
||||
// if (node.type == .text) std.debug.print("{s}\n", .{node.text.?.content});
|
||||
// std.debug.print("{any}\n", .{node});
|
||||
// }
|
||||
// // std.debug.print("{any}",.{nodes[0].tag.?.body.block.body});
|
||||
try testing.expect(nodes[0].tag.?.body.block.body[0].type == .text);
|
||||
try testing.expectEqualStrings("Bazinga!", nodes[0].tag.?.body.block.body[0].text.?.content);
|
||||
const child_nodes = nodes[0].tag.?.body.block.body;
|
||||
|
||||
try testing.expectEqual(@as(usize, 2), child_nodes.len);
|
||||
|
||||
try testing.expect(child_nodes[0].type == .text);
|
||||
try testing.expect(child_nodes[1].type == .text);
|
||||
try testing.expectEqualStrings("Bazinga!", child_nodes[0].text.?.content);
|
||||
try testing.expectEqualStrings(" haha", child_nodes[1].text.?.content);
|
||||
}
|
||||
|
||||
test "parse simple cycle" {
|
||||
|
|
@ -1006,13 +1003,7 @@ test "parse spaceless nested" {
|
|||
try testing.expect(nodes[0].type == .tag);
|
||||
try testing.expect(nodes[0].tag.?.kind == .spaceless);
|
||||
const sl = nodes[0].tag.?.body.spaceless;
|
||||
// for (sl.body) |node| {
|
||||
// if (node.type == .text) {
|
||||
// std.debug.print("{s}\n", .{node.text.?.content});
|
||||
// } else {
|
||||
// std.debug.print("{any}\n", .{node});
|
||||
// }
|
||||
// }
|
||||
|
||||
try testing.expectEqual(@as(usize, 4), sl.body.len);
|
||||
}
|
||||
test "parse templatetag openblock" {
|
||||
|
|
@ -1183,7 +1174,6 @@ test "parse simple verbatim" {
|
|||
try testing.expect(nodes[1].type == .tag);
|
||||
try testing.expect(nodes[1].tag.?.kind == .verbatim);
|
||||
const vb = nodes[1].tag.?.body.verbatim;
|
||||
std.debug.print("{s}\n", .{vb.name.?});
|
||||
try testing.expectEqualStrings("{{ variável }}{% endblock %}", vb.content);
|
||||
try testing.expect(std.mem.eql(u8, vb.name.?, ""));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue