[libcxx-commits] [PATCH] D116381: [libc++][format] Fix precision parser conformance.
Arthur O'Dwyer via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Dec 29 12:12:34 PST 2021
Quuxplusone added a comment.
LGTM FWIW
================
Comment at: libcxx/test/std/utilities/format/format.functions/format_tests.h:180
+ check_exception(
+ "A format-spec arg-id should terminate at a '}'",
+ STR("hello {0:{01}}"), world, 1);
----------------
It would be friendlier to make this message `"A format-spec arg-id shouldn't have leading zeros"`.
Also (definitely unrelated to this PR) I think it's superfluous to keep repeating the word `format-spec` in all these messages. The exception type is already `format_error` and it's thrown during format-string parsing, right? I think `"An arg-id shouldn't...` would be perfectly unambiguous to the catcher.
================
Comment at: libcxx/test/std/utilities/format/format.functions/format_tests.h:199
+ // Precision may have leading zeros
+ check(STR("hello w"), STR("hello {:.00001}"), world);
check_exception(
----------------
I'd like to see another test case for `{:.010}` to conclusively prove it's parsed as decimal 10, not octal 8.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D116381/new/
https://reviews.llvm.org/D116381
More information about the libcxx-commits
mailing list