* [PATCH v6] json-writer: fixups for V5
@ 2018-03-28 13:09 git
0 siblings, 0 replies; only message in thread
From: git @ 2018-03-28 13:09 UTC (permalink / raw)
To: git; +Cc: gitster, peff, wink, Jeff Hostetler
From: Jeff Hostetler <jeffhost@microsoft.com>
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 <jeffhost@microsoft.com>
---
json-writer.c | 4 ++--
t/t0019-json-writer.sh | 36 ++++++++++++++++++------------------
2 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/json-writer.c b/json-writer.c
index 1b49158..dbfcf70 100644
--- a/json-writer.c
+++ b/json-writer.c
@@ -165,7 +165,7 @@ void jw_object_string(struct json_writer *jw, const char *key, const char *value
void 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)
diff --git a/t/t0019-json-writer.sh b/t/t0019-json-writer.sh
index a04c055..bd6d474 100755
--- a/t/t0019-json-writer.sh
+++ b/t/t0019-json-writer.sh
@@ -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 \
--
2.9.3
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2018-03-28 13:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-28 13:09 [PATCH v6] json-writer: fixups for V5 git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).