diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-01-17 14:26:08 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-01-17 14:26:08 +0900 |
| commit | 94877ef2f689617706a646cf0abda7dc25ceba88 (patch) | |
| tree | 8e9ae94cc09ddb25724b4cc33a900cbc17d91541 /src/root.zig | |
| parent | b2c37cbc1ce7f6638d7b57376719f2e0ba2d53ca (diff) | |
| download | zgjq-94877ef2f689617706a646cf0abda7dc25ceba88.tar.gz zgjq-94877ef2f689617706a646cf0abda7dc25ceba88.tar.zst zgjq-94877ef2f689617706a646cf0abda7dc25ceba88.zip | |
implement array index filter
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]"); +} |
