diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-01-17 18:40:47 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-01-17 18:40:47 +0900 |
| commit | 22a5d1617e79f176ecfca22d6c72be215f0da8b6 (patch) | |
| tree | 4424a15f2e069aa27312a9e1885d8446ad12bea1 /src/root.zig | |
| parent | d4bacf19b56c21afc7f2f0b5efb244b072873119 (diff) | |
| download | zgjq-22a5d1617e79f176ecfca22d6c72be215f0da8b6.tar.gz zgjq-22a5d1617e79f176ecfca22d6c72be215f0da8b6.tar.zst zgjq-22a5d1617e79f176ecfca22d6c72be215f0da8b6.zip | |
implement object key access
Diffstat (limited to 'src/root.zig')
| -rw-r--r-- | src/root.zig | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/root.zig b/src/root.zig index fa48c7b..f75f062 100644 --- a/src/root.zig +++ b/src/root.zig @@ -58,3 +58,15 @@ test "array index filter" { \\ 81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100] , ".[100]"); } + +test "object key filter" { + var debug_allocator = std.heap.DebugAllocator(.{}).init; + defer std.debug.assert(debug_allocator.deinit() == .ok); + const allocator = debug_allocator.allocator(); + + try testRun("123", allocator, "{\"a\":123}", ".a"); + try testRun("null", allocator, "{\"a\":123}", ".b"); + try testRun("\"hello\"", allocator, "{\"foo\":\"hello\"}", ".foo"); + try testRun("[1,2,3]", allocator, "{\"arr\":[1,2,3]}", ".arr"); + try testRun("{\"bar\":true}", allocator, "{\"foo\":{\"bar\":true}}", ".foo"); +} |
