From: git@jeffhostetler.com
To: git@vger.kernel.org
Cc: gitster@pobox.com, peff@peff.net, wink@saville.com,
Jeff Hostetler <jeffhost@microsoft.com>
Subject: [PATCH v6] json-writer: fixups for V5
Date: Wed, 28 Mar 2018 13:09:40 +0000 [thread overview]
Message-ID: <20180328130940.44223-1-git@jeffhostetler.com> (raw)
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
reply other threads:[~2018-03-28 13:09 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180328130940.44223-1-git@jeffhostetler.com \
--to=git@jeffhostetler.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jeffhost@microsoft.com \
--cc=peff@peff.net \
--cc=wink@saville.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).