update: cleanup

This commit is contained in:
Lucas F. 2026-01-16 08:32:17 -03:00
parent 327a44baf0
commit 5ff94ccf17

View file

@ -7,6 +7,9 @@ const FilterError = @import("filters.zig").FilterError;
const std_time = std.time; const std_time = std.time;
test "filters upper/lower, capfirst" { test "filters upper/lower, capfirst" {
std.debug.print("____________________________________________________\n", .{});
std.debug.print("1 - upper/lower, capfirst\n", .{});
const alloc = testing.allocator; const alloc = testing.allocator;
var ctx = Context.init(alloc); var ctx = Context.init(alloc);
defer ctx.deinit(); defer ctx.deinit();
@ -29,6 +32,9 @@ test "filters upper/lower, capfirst" {
} }
test "builtin filters - add" { test "builtin filters - add" {
std.debug.print("____________________________________________________\n", .{});
std.debug.print("2 - add\n", .{});
const alloc = testing.allocator; const alloc = testing.allocator;
const add = builtin_filters.get("add").?; const add = builtin_filters.get("add").?;
@ -49,6 +55,9 @@ test "builtin filters - add" {
} }
test "builtin filters - default and default_if_none" { test "builtin filters - default and default_if_none" {
std.debug.print("____________________________________________________\n", .{});
std.debug.print("3 - default and default_if_none\n", .{});
const alloc = testing.allocator; const alloc = testing.allocator;
const default_filter = builtin_filters.get("default").?; const default_filter = builtin_filters.get("default").?;
const default_if_none = builtin_filters.get("default_if_none").?; const default_if_none = builtin_filters.get("default_if_none").?;
@ -73,6 +82,9 @@ test "builtin filters - default and default_if_none" {
} }
test "builtin filters - length" { test "builtin filters - length" {
std.debug.print("____________________________________________________\n", .{});
std.debug.print("4 - length\n", .{});
const alloc = testing.allocator; const alloc = testing.allocator;
const length = builtin_filters.get("length").?; const length = builtin_filters.get("length").?;
@ -94,7 +106,10 @@ test "builtin filters - length" {
try testing.expect((try length(ctx.allocator(), list_val, null)).int == 4); try testing.expect((try length(ctx.allocator(), list_val, null)).int == 4);
} }
test "builtin filters - length com dict" { test "builtin filters - length with dict" {
std.debug.print("____________________________________________________\n", .{});
std.debug.print("5 - length with dict\n", .{});
const alloc = testing.allocator; const alloc = testing.allocator;
var ctx = Context.init(alloc); var ctx = Context.init(alloc);
defer ctx.deinit(); defer ctx.deinit();
@ -114,6 +129,9 @@ test "builtin filters - length com dict" {
} }
test "builtin filters - first and last" { test "builtin filters - first and last" {
std.debug.print("____________________________________________________\n", .{});
std.debug.print("6 - first and last\n", .{});
const alloc = testing.allocator; const alloc = testing.allocator;
const first = builtin_filters.get("first").?; const first = builtin_filters.get("first").?;
const last = builtin_filters.get("last").?; const last = builtin_filters.get("last").?;
@ -143,6 +161,9 @@ test "builtin filters - first and last" {
} }
test "builtin filters - join" { test "builtin filters - join" {
std.debug.print("____________________________________________________\n", .{});
std.debug.print("7 - join\n", .{});
const alloc = testing.allocator; const alloc = testing.allocator;
const join = builtin_filters.get("join").?; const join = builtin_filters.get("join").?;
@ -170,6 +191,9 @@ test "builtin filters - join" {
} }
test "builtin filters - yesno" { test "builtin filters - yesno" {
std.debug.print("____________________________________________________\n", .{});
std.debug.print("8 - yesno\n", .{});
const alloc = testing.allocator; const alloc = testing.allocator;
const yesno = builtin_filters.get("yesno").?; const yesno = builtin_filters.get("yesno").?;
@ -192,6 +216,9 @@ test "builtin filters - yesno" {
} }
test "builtin filters - truncatechars and truncatechars_html" { test "builtin filters - truncatechars and truncatechars_html" {
std.debug.print("____________________________________________________\n", .{});
std.debug.print("9 - truncatechars and truncatechars_html\n", .{});
const alloc = testing.allocator; const alloc = testing.allocator;
const truncatechars = builtin_filters.get("truncatechars").?; const truncatechars = builtin_filters.get("truncatechars").?;
const truncatechars_html = builtin_filters.get("truncatechars_html").?; const truncatechars_html = builtin_filters.get("truncatechars_html").?;
@ -218,6 +245,9 @@ test "builtin filters - truncatechars and truncatechars_html" {
} }
test "builtin filters - truncatewords" { test "builtin filters - truncatewords" {
std.debug.print("____________________________________________________\n", .{});
std.debug.print("10 - truncatewords\n", .{});
const alloc = testing.allocator; const alloc = testing.allocator;
const truncatewords = builtin_filters.get("truncatewords").?; const truncatewords = builtin_filters.get("truncatewords").?;
const truncatewords_html = builtin_filters.get("truncatewords_html").?; const truncatewords_html = builtin_filters.get("truncatewords_html").?;
@ -241,6 +271,9 @@ test "builtin filters - truncatewords" {
} }
test "builtin filters - slice" { test "builtin filters - slice" {
std.debug.print("____________________________________________________\n", .{});
std.debug.print("11 - slice\n", .{});
const alloc = testing.allocator; const alloc = testing.allocator;
const slice = builtin_filters.get("slice").?; const slice = builtin_filters.get("slice").?;
@ -267,6 +300,9 @@ test "builtin filters - slice" {
} }
test "builtin filters - safe and force_escape" { test "builtin filters - safe and force_escape" {
std.debug.print("____________________________________________________\n", .{});
std.debug.print("12 - safe and force_escape\n", .{});
const alloc = testing.allocator; const alloc = testing.allocator;
const safe = builtin_filters.get("safe").?; const safe = builtin_filters.get("safe").?;
const force_escape = builtin_filters.get("force_escape").?; const force_escape = builtin_filters.get("force_escape").?;
@ -287,6 +323,9 @@ test "builtin filters - safe and force_escape" {
} }
test "builtin filters - linebreaksbr and linebreaks" { test "builtin filters - linebreaksbr and linebreaks" {
std.debug.print("____________________________________________________\n", .{});
std.debug.print("13 - linebreaksbr and linebreaks\n", .{});
const alloc = testing.allocator; const alloc = testing.allocator;
const linebreaksbr = builtin_filters.get("linebreaksbr").?; const linebreaksbr = builtin_filters.get("linebreaksbr").?;
const linebreaks = builtin_filters.get("linebreaks").?; const linebreaks = builtin_filters.get("linebreaks").?;
@ -306,6 +345,9 @@ test "builtin filters - linebreaksbr and linebreaks" {
} }
test "builtin filters - escape and force_escape" { test "builtin filters - escape and force_escape" {
std.debug.print("____________________________________________________\n", .{});
std.debug.print("14 - escape and force_escape\n", .{});
const alloc = testing.allocator; const alloc = testing.allocator;
var ctx = Context.init(alloc); var ctx = Context.init(alloc);
defer ctx.deinit(); defer ctx.deinit();
@ -326,6 +368,9 @@ test "builtin filters - escape and force_escape" {
} }
test "builtin filters - striptags" { test "builtin filters - striptags" {
std.debug.print("____________________________________________________\n", .{});
std.debug.print("15 - striptags\n", .{});
const alloc = testing.allocator; const alloc = testing.allocator;
var ctx = Context.init(alloc); var ctx = Context.init(alloc);
defer ctx.deinit(); defer ctx.deinit();
@ -341,6 +386,9 @@ test "builtin filters - striptags" {
} }
test "builtin filters - slugify" { test "builtin filters - slugify" {
std.debug.print("____________________________________________________\n", .{});
std.debug.print("16 - slugify\n", .{});
const alloc = testing.allocator; const alloc = testing.allocator;
var ctx = Context.init(alloc); var ctx = Context.init(alloc);
defer ctx.deinit(); defer ctx.deinit();
@ -356,6 +404,9 @@ test "builtin filters - slugify" {
} }
test "builtin filters - floatformat" { test "builtin filters - floatformat" {
std.debug.print("____________________________________________________\n", .{});
std.debug.print("17 - floatformat\n", .{});
const alloc = testing.allocator; const alloc = testing.allocator;
var ctx = Context.init(alloc); var ctx = Context.init(alloc);
defer ctx.deinit(); defer ctx.deinit();
@ -384,6 +435,9 @@ test "builtin filters - floatformat" {
} }
test "builtin filters - stringformat" { test "builtin filters - stringformat" {
std.debug.print("____________________________________________________\n", .{});
std.debug.print("18 - stringformat\n", .{});
const alloc = testing.allocator; const alloc = testing.allocator;
var ctx = Context.init(alloc); var ctx = Context.init(alloc);
defer ctx.deinit(); defer ctx.deinit();
@ -404,6 +458,9 @@ test "builtin filters - stringformat" {
} }
test "builtin filters - cut" { test "builtin filters - cut" {
std.debug.print("____________________________________________________\n", .{});
std.debug.print("19 - cut\n", .{});
const alloc = testing.allocator; const alloc = testing.allocator;
var ctx = Context.init(alloc); var ctx = Context.init(alloc);
defer ctx.deinit(); defer ctx.deinit();
@ -419,6 +476,9 @@ test "builtin filters - cut" {
} }
test "builtin filters - title" { test "builtin filters - title" {
std.debug.print("____________________________________________________\n", .{});
std.debug.print("20 - title\n", .{});
const alloc = testing.allocator; const alloc = testing.allocator;
var ctx = Context.init(alloc); var ctx = Context.init(alloc);
defer ctx.deinit(); defer ctx.deinit();
@ -434,6 +494,9 @@ test "builtin filters - title" {
} }
test "builtin filters - wordcount" { test "builtin filters - wordcount" {
std.debug.print("____________________________________________________\n", .{});
std.debug.print("21 - wordcount\n", .{});
const alloc = testing.allocator; const alloc = testing.allocator;
var ctx = Context.init(alloc); var ctx = Context.init(alloc);
defer ctx.deinit(); defer ctx.deinit();
@ -449,6 +512,9 @@ test "builtin filters - wordcount" {
} }
test "builtin filters - urlencode" { test "builtin filters - urlencode" {
std.debug.print("____________________________________________________\n", .{});
std.debug.print("22 - urlencode\n", .{});
const alloc = testing.allocator; const alloc = testing.allocator;
var ctx = Context.init(alloc); var ctx = Context.init(alloc);
defer ctx.deinit(); defer ctx.deinit();
@ -464,6 +530,9 @@ test "builtin filters - urlencode" {
} }
test "builtin filters - pluralize" { test "builtin filters - pluralize" {
std.debug.print("____________________________________________________\n", .{});
std.debug.print("23 - pluralize\n", .{});
const alloc = testing.allocator; const alloc = testing.allocator;
var ctx = Context.init(alloc); var ctx = Context.init(alloc);
defer ctx.deinit(); defer ctx.deinit();
@ -490,6 +559,9 @@ test "builtin filters - pluralize" {
} }
test "builtin filters - addslashes, center, date" { test "builtin filters - addslashes, center, date" {
std.debug.print("____________________________________________________\n", .{});
std.debug.print("24 - addslashes, center, date\n", .{});
const alloc = testing.allocator; const alloc = testing.allocator;
var ctx = Context.init(alloc); var ctx = Context.init(alloc);
defer ctx.deinit(); defer ctx.deinit();
@ -514,6 +586,9 @@ test "builtin filters - addslashes, center, date" {
} }
test "builtin filters - dictsort and dictsortreversed" { test "builtin filters - dictsort and dictsortreversed" {
std.debug.print("____________________________________________________\n", .{});
std.debug.print("25 - dictsort and dictsortreversed\n", .{});
const alloc = testing.allocator; const alloc = testing.allocator;
var ctx = Context.init(alloc); var ctx = Context.init(alloc);
defer ctx.deinit(); defer ctx.deinit();
@ -544,6 +619,9 @@ test "builtin filters - dictsort and dictsortreversed" {
} }
test "builtin filters - divisibleby, escapejs, filesizeformat, get_digit, json_script" { test "builtin filters - divisibleby, escapejs, filesizeformat, get_digit, json_script" {
std.debug.print("____________________________________________________\n", .{});
std.debug.print("26 - divisibleby, escapejs, filesizeformat, get_digit, json_script\n", .{});
const alloc = testing.allocator; const alloc = testing.allocator;
var ctx = Context.init(alloc); var ctx = Context.init(alloc);
defer ctx.deinit(); defer ctx.deinit();
@ -579,6 +657,9 @@ test "builtin filters - divisibleby, escapejs, filesizeformat, get_digit, json_s
} }
test "builtin filters - escapeseq, iriencode, linenumbers" { test "builtin filters - escapeseq, iriencode, linenumbers" {
std.debug.print("____________________________________________________\n", .{});
std.debug.print("27 - escapeseq, iriencode, linenumbers\n", .{});
const alloc = testing.allocator; const alloc = testing.allocator;
var ctx = Context.init(alloc); var ctx = Context.init(alloc);
defer ctx.deinit(); defer ctx.deinit();
@ -601,6 +682,9 @@ test "builtin filters - escapeseq, iriencode, linenumbers" {
} }
test "builtin filters - ljust, rjust, center" { test "builtin filters - ljust, rjust, center" {
std.debug.print("____________________________________________________\n", .{});
std.debug.print("28 - ljust, rjust, center\n", .{});
const alloc = testing.allocator; const alloc = testing.allocator;
var ctx = Context.init(alloc); var ctx = Context.init(alloc);
defer ctx.deinit(); defer ctx.deinit();
@ -623,6 +707,9 @@ test "builtin filters - ljust, rjust, center" {
} }
test "builtin filters - make_list, phone2numeric, pprint" { test "builtin filters - make_list, phone2numeric, pprint" {
std.debug.print("____________________________________________________\n", .{});
std.debug.print("29 - make_list, phone2numeric, pprint\n", .{});
const alloc = testing.allocator; const alloc = testing.allocator;
var ctx = Context.init(alloc); var ctx = Context.init(alloc);
defer ctx.deinit(); defer ctx.deinit();
@ -648,6 +735,9 @@ test "builtin filters - make_list, phone2numeric, pprint" {
} }
test "builtin filters - random, safeseq" { test "builtin filters - random, safeseq" {
std.debug.print("____________________________________________________\n", .{});
std.debug.print("30 - random, safeseq\n", .{});
const alloc = testing.allocator; const alloc = testing.allocator;
var ctx = Context.init(alloc); var ctx = Context.init(alloc);
defer ctx.deinit(); defer ctx.deinit();
@ -693,6 +783,9 @@ test "builtin filters - random, safeseq" {
// } // }
test "builtin filters - urlize, urlizetrunc, wordwrap, unordered_list" { test "builtin filters - urlize, urlizetrunc, wordwrap, unordered_list" {
std.debug.print("____________________________________________________\n", .{});
std.debug.print("32 - urlize, urlizetrunc, wordwrap, unordered_list\n", .{});
const alloc = testing.allocator; const alloc = testing.allocator;
var ctx = Context.init(alloc); var ctx = Context.init(alloc);
defer ctx.deinit(); defer ctx.deinit();
@ -718,6 +811,9 @@ test "builtin filters - urlize, urlizetrunc, wordwrap, unordered_list" {
} }
test "builtin filters - unordered_list" { test "builtin filters - unordered_list" {
std.debug.print("____________________________________________________\n", .{});
std.debug.print("33 - unordered_list\n", .{});
const alloc = testing.allocator; const alloc = testing.allocator;
var ctx = Context.init(alloc); var ctx = Context.init(alloc);
defer ctx.deinit(); defer ctx.deinit();
@ -737,6 +833,5 @@ test "builtin filters - unordered_list" {
\\<li>item2</li> \\<li>item2</li>
\\</ul> \\</ul>
; ;
std.debug.print("lista gerada: {any}\n", .{ul.string});
try testing.expectEqualStrings(expected, ul.string); try testing.expectEqualStrings(expected, ul.string);
} }