git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v8 1/2] json_writer: new routines to create data in JSON format

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Jun 7, 2018, 17:24 UTC
Message-ID
<CAPig+cRBCr2dKOBFnUF_D1SXfPTE5SPbB4t=y51VGa_jLQGkcA@mail.gmail.com>
In-Reply-To
<20180607141209.24423-2-git@jeffhostetler.com>
On Thu, Jun 7, 2018 at 10:12 AM,  <git@jeffhostetler.com> wrote:
Show 23 quoted lines
> Add a series of jw_ routines and "struct json_writer" structure to compose
> JSON data.  The resulting string data can then be output by commands wanting
> to support a JSON output format.
> [...]
> Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
> ---
> diff --git a/t/t0019-json-writer.sh b/t/t0019-json-writer.sh
> @@ -0,0 +1,236 @@
> +test_expect_success 'simple object' '
> +       cat >expect <<-\EOF &&
> +       {"a":"abc","b":42,"c":3.14,"d":true,"e":false,"f":null}
> +       EOF
> +       test-json-writer >actual \
> +               @object \
> +                       @object-string a abc \
> +                       @object-int b 42 \
> +                       @object-double c 2 3.140 \
> +                       @object-true d \
> +                       @object-false e \
> +                       @object-null f \
> +               @end &&
> +       test_cmp expect actual
> +'

To make it easier on people writing these tests, it might be nice for this to be less noisy by getting rid of "@" and "\". To get rid of "\", the test program could grab its script commands from stdin (one instruction per line) rather than from argv[]. For instance:

    test-json-writer >actual <<-\EOF &&
        object
            object-string a abc
            ...
        end
    EOF
Not a big deal, and certainly not worth a re-roll.
Previous: git@jeffhostetler.comNext: Jeff Hostetler
Message 3 of 13 in “json-writer V8”
  1. 0/2 json-writer V8git@jeffhostetler.com, Jun 7, 2018
  2. 1/2 json_writer: new routines to create data in JSON formatgit@jeffhostetler.com, Jun 7, 2018
  3. Eric SunshineJun 7, 2018
  4. Jeff HostetlerJun 8, 2018
  5. René ScharfeJun 8, 2018
  6. Jeff HostetlerJun 11, 2018
  7. René ScharfeJun 8, 2018
  8. Jeff HostetlerJun 11, 2018
  9. René ScharfeJun 8, 2018
  10. Jeff HostetlerJun 11, 2018
  11. 2/2 json-writer: t0019: add perl unit testgit@jeffhostetler.com, Jun 7, 2018
  12. Eric SunshineJun 7, 2018
  13. Jeff HostetlerJun 11, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.