aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/root.zig
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-01-25 21:07:22 +0900
committernsfisis <nsfisis@gmail.com>2026-01-25 21:07:22 +0900
commit8263832eb8c23968f0cfea15b5cb1bfa3546d540 (patch)
tree0285af48231c3f59db2f372a1947261f83fb2ee0 /src/root.zig
parent7e516e5e083518f11a7399e895718572f7c7fb79 (diff)
downloadzgjq-8263832eb8c23968f0cfea15b5cb1bfa3546d540.tar.gz
zgjq-8263832eb8c23968f0cfea15b5cb1bfa3546d540.tar.zst
zgjq-8263832eb8c23968f0cfea15b5cb1bfa3546d540.zip
pretty-print results
Diffstat (limited to 'src/root.zig')
-rw-r--r--src/root.zig28
1 files changed, 24 insertions, 4 deletions
diff --git a/src/root.zig b/src/root.zig
index 6cdc276..123dc7e 100644
--- a/src/root.zig
+++ b/src/root.zig
@@ -61,8 +61,18 @@ test "identity filter" {
try testRun("3.1415", "3.1415", ".");
try testRun("[]", "[]", ".");
try testRun("{}", "{}", ".");
- try testRun("[1,2,3]", "[1,2,3]", ".");
- try testRun("{\"a\":123}", "{\"a\":123}", ".");
+ try testRun(
+ \\[
+ \\ 1,
+ \\ 2,
+ \\ 3
+ \\]
+ , "[1,2,3]", ".");
+ try testRun(
+ \\{
+ \\ "a": 123
+ \\}
+ , "{\"a\":123}", ".");
}
test "index access" {
@@ -81,8 +91,18 @@ test "index access" {
try testRun("123", "{\"a\":123}", ".a");
try testRun("null", "{\"a\":123}", ".b");
try testRun("\"hello\"", "{\"foo\":\"hello\"}", ".foo");
- try testRun("[1,2,3]", "{\"arr\":[1,2,3]}", ".arr");
- try testRun("{\"bar\":true}", "{\"foo\":{\"bar\":true}}", ".foo");
+ try testRun(
+ \\[
+ \\ 1,
+ \\ 2,
+ \\ 3
+ \\]
+ , "{\"arr\":[1,2,3]}", ".arr");
+ try testRun(
+ \\{
+ \\ "bar": true
+ \\}
+ , "{\"foo\":{\"bar\":true}}", ".foo");
try testRun("123", "{\"a\":123}", ".[\"a\"]");
try testRun("null", "{\"a\":123}", ".[\"b\"]");