json-writer: fixups for V5
PATCH v6 1/1 json-writer: fixups for V5
From: Jeff Hostetler <[email protected]>
Please squash this onto the top of jh/json-writer.
Fix leading whitespace in t0019 using tricked suggested by Junio. Fix unnecessary cast for intmax_t suggested by Wink.
Signed-off-by Jeff Hostetler <[email protected]>
--- json-writer.c | 4 ++-- t/t0019-json-writer.sh | 36 ++++++++++++++++++------------------ 2 files changed, 20 insertions(+), 20 deletions(-)
json-writer.c +2 -2
@@ -165,7 +165,7 @@ void jw_object_string(struct json_writer *jw, const char *key, const char *valuevoid jw_object_intmax (struct json_writer *jw,const char *key,intmax_t value) {object_common (jw, key); -strbuf_addf (&jw->json,"%" PRIdMAX, (intmax_t )value); +strbuf_addf (&jw->json,"%" PRIdMAX, value); } void jw_object_double(struct json_writer *jw, const char *key, int precision,
@@ -303,7 +303,7 @@ void jw_array_string(struct json_writer *jw, const char *value)void jw_array_intmax (struct json_writer *jw,intmax_t value) {array_common (jw); -strbuf_addf (&jw->json,"%" PRIdMAX, (intmax_t )value); +strbuf_addf (&jw->json,"%" PRIdMAX, value); }void jw_array_double (struct json_writer *jw,int precision,double value)
t/t0019-json-writer.sh +18 -18
@@ -166,24 +166,24 @@ test_expect_success 'nested inline object and array 2' ' ' test_expect_success 'pretty nested inline object and array 2' ' - cat >expect <<EOF && -{ - "a": "abc", - "b": 42, - "sub1": { - "c": 3.14, - "d": true, - "sub2": [ - false, - { - "g": 0, - "h": 1 - }, - null - ] - } -} -EOF + sed -e "s/^|//" >expect <<-\EOF && + |{ + | "a": "abc", + | "b": 42, + | "sub1": { + | "c": 3.14, + | "d": true, + | "sub2": [ + | false, + | { + | "g": 0, + | "h": 1 + | }, + | null + | ] + | } + |} + EOF test-json-writer >actual \ --pretty \ @object \
Signature · 1 line
2.9.3