From 94877ef2f689617706a646cf0abda7dc25ceba88 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 17 Jan 2026 14:26:08 +0900 Subject: implement array index filter --- src/root.zig | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/root.zig') diff --git a/src/root.zig b/src/root.zig index 61b61f5..d22a239 100644 --- a/src/root.zig +++ b/src/root.zig @@ -39,3 +39,13 @@ test "identity filter" { try testRun("[1,2,3]", allocator, "[1,2,3]", "."); try testRun("{\"a\":123}", allocator, "{\"a\":123}", "."); } + +test "array index filter" { + var debug_allocator = std.heap.DebugAllocator(.{}).init; + defer std.debug.assert(debug_allocator.deinit() == .ok); + const allocator = debug_allocator.allocator(); + + try testRun("null", allocator, "[]", ".[0]"); + try testRun("1", allocator, "[1,2,3]", ".[0]"); + try testRun("null", allocator, "[1,2,3]", ".[5]"); +} -- cgit v1.3-1-g0d28