Fix printing of json_value
This commit is contained in:
3
.github/workflows/build-and-test.yml
vendored
3
.github/workflows/build-and-test.yml
vendored
@@ -21,3 +21,6 @@ jobs:
|
|||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: ./test.sh
|
run: ./test.sh
|
||||||
|
|
||||||
|
- name: Test output against jq
|
||||||
|
run: ./bin/release/parse sample-files/large-file.json | jq >/dev/null
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ void print_array(struct json_value** arr, int cur_indent, int indent_amount)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 0; arr[i + 1] != NULL; i++) {
|
for (size_t i = 0; arr[i] != NULL; i++) {
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
add_indent(cur_indent);
|
add_indent(cur_indent);
|
||||||
print_json_value(*arr[i], cur_indent + indent_amount, indent_amount);
|
print_json_value(*arr[i], cur_indent + indent_amount, indent_amount);
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
struct json_value x = parse_json_value(fp);
|
struct json_value x = parse_json_value(fp);
|
||||||
|
|
||||||
// print_json(x, 1);
|
print_json(x, 1);
|
||||||
|
|
||||||
json_value_delete(x);
|
json_value_delete(x);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user