diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 20:01:36 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 20:01:36 +0000 |
commit | 62e4c68907d8d33709c2c1f92a161dff00b3d5f2 (patch) | |
tree | adbbaf3acf88ea08f6eeec4b75ee98ad3b07fbdc /src/yajlpp/test_json_ptr_walk.sh | |
parent | Initial commit. (diff) | |
download | lnav-upstream/0.11.2.tar.xz lnav-upstream/0.11.2.zip |
Adding upstream version 0.11.2.upstream/0.11.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/yajlpp/test_json_ptr_walk.sh')
-rw-r--r-- | src/yajlpp/test_json_ptr_walk.sh | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/src/yajlpp/test_json_ptr_walk.sh b/src/yajlpp/test_json_ptr_walk.sh new file mode 100644 index 0000000..bcaf1ec --- /dev/null +++ b/src/yajlpp/test_json_ptr_walk.sh @@ -0,0 +1,77 @@ +#! /bin/bash + +run_test ./drive_json_ptr_walk <<EOF +{ "foo" : 1 } +EOF + +check_output "simple object" <<EOF +/foo = 1 +EOF + +run_test ./drive_json_ptr_walk <<EOF +{ "~tstack/julia" : 1 } +EOF + +check_output "escaped object" <<EOF +/~0tstack~1julia = 1 +EOF + +run_test ./drive_json_ptr_walk <<EOF +1 +EOF + +check_output "root value" <<EOF + = 1 +EOF + +run_test ./drive_json_ptr_walk <<EOF +[1, 2, 3] +EOF + +check_output "array" <<EOF +/0 = 1 +/1 = 2 +/2 = 3 +EOF + +run_test ./drive_json_ptr_walk <<EOF +[1, 2, 3, [4, 5, 6], 7, 8, 9, [10, 11, [12, 13, 14], 15], 16] +EOF + +check_output "nested array" <<EOF +/0 = 1 +/1 = 2 +/2 = 3 +/3/0 = 4 +/3/1 = 5 +/3/2 = 6 +/4 = 7 +/5 = 8 +/6 = 9 +/7/0 = 10 +/7/1 = 11 +/7/2/0 = 12 +/7/2/1 = 13 +/7/2/2 = 14 +/7/3 = 15 +/8 = 16 +EOF + +run_test ./drive_json_ptr_walk <<EOF +[null, true, 123.0, "foo", { "bar" : { "baz" : [1, 2, 3]} }, ["a", null]] +EOF + +check_error_output "" <<EOF +EOF + +check_output "complex" <<EOF +/0 = null +/1 = true +/2 = 123.0 +/3 = "foo" +/4/bar/baz/0 = 1 +/4/bar/baz/1 = 2 +/4/bar/baz/2 = 3 +/5/0 = "a" +/5/1 = null +EOF |