aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/root.zig
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-01-25 18:16:24 +0900
committernsfisis <nsfisis@gmail.com>2026-01-25 18:16:24 +0900
commit11ff1132c8116aef2296cc6ebd3c40b5e7e7b43f (patch)
tree72d5f22d96e2430fe943ede11dc76c9c8dab3517 /src/root.zig
parent48d9ec8aef4c3e7f3574346a6cf6a1fa3d725561 (diff)
downloadzgjq-11ff1132c8116aef2296cc6ebd3c40b5e7e7b43f.tar.gz
zgjq-11ff1132c8116aef2296cc6ebd3c40b5e7e7b43f.tar.zst
zgjq-11ff1132c8116aef2296cc6ebd3c40b5e7e7b43f.zip
implement string literals
Diffstat (limited to 'src/root.zig')
-rw-r--r--src/root.zig7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/root.zig b/src/root.zig
index cce3ce5..650acdf 100644
--- a/src/root.zig
+++ b/src/root.zig
@@ -42,6 +42,13 @@ fn testRunMultiple(expected: []const []const u8, input: []const u8, query: []con
try std.testing.expectEqual(null, try runtime.next());
}
+test "literals" {
+ try testRun("\"hello\"", "null", "\"hello\"");
+ try testRun("\"\"", "null", "\"\"");
+ try testRun("\"hello\\nworld\"", "null", "\"hello\\nworld\"");
+ try testRun("\"hello\"", "{\"a\":1}", "\"hello\"");
+}
+
test "identity filter" {
try testRun("null", "null", ".");
try testRun("false", "false", ".");