diff options
Diffstat (limited to 'src/root.zig')
| -rw-r--r-- | src/root.zig | 10 |
1 files changed, 10 insertions, 0 deletions
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]"); +} |
