[PATCH 4/7] bundle-uri: unit test "key=value" parsing
- From
Teng Long <dyroneteng@gmail.com>
- Date
- Sep 1, 2022, 02:38 UTC
- Message-ID
- <20220901023838.19263-1-tenglong.tl@alibaba-inc.com>
- In-Reply-To
- <7e4e4656e530395d055abac2a59e93866c9a0de2.1661181174.git.gitgitgadget@gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
Show 5 quoted lines
> +> + init_bundle_list(&list);
> + while (strbuf_getline(&sb, stdin) != EOF) {
> + if (bundle_uri_parse_line(&list, sb.buf) < 0)
> + err = error("bad line: '%s'", sb.buf);
> + }The command to write such a test is useful for people who want to experiment about the feature, Thanks. On top of that, I have a little question about the condition:
if (bundle_uri_parse_line(&list, sb.buf) < 0)
"bundle_uri_parse_line" will call "bundle_list_update" inside, and could get the result of it as "bundle_uri_parse_line"'s return, then actually "bundle_list_update" could return "1", so I'm not sure but maybe the line could modified to:
if (bundle_uri_parse_line(&list, sb.buf))
at here.
Thanks.