mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-09 11:27:28 -03:00
test: Document non-parity between tinyformat and ConstevalFormatstring
- For "%n", which is supposed to write to the argument for printf. - For string/integer mismatches of width/precision specifiers. Co-Authored-By: Ryan Ofsky <ryan@ofsky.org>
This commit is contained in:
parent
533013cba2
commit
76cca4aa6f
2 changed files with 11 additions and 0 deletions
|
@ -126,6 +126,15 @@ BOOST_AUTO_TEST_CASE(ConstevalFormatString_NumSpec)
|
|||
FailFmtWithError<2>("%1$.*2$", err_term);
|
||||
FailFmtWithError<2>("%1$9.*2$", err_term);
|
||||
|
||||
// Non-parity between tinyformat and ConstevalFormatString.
|
||||
// tinyformat throws but ConstevalFormatString does not.
|
||||
BOOST_CHECK_EXCEPTION(tfm::format(ConstevalFormatString<1>{"%n"}, 0), tfm::format_error,
|
||||
HasReason{"tinyformat: %n conversion spec not supported"});
|
||||
BOOST_CHECK_EXCEPTION(tfm::format(ConstevalFormatString<2>{"%*s"}, "hi", "hi"), tfm::format_error,
|
||||
HasReason{"tinyformat: Cannot convert from argument type to integer for use as variable width or precision"});
|
||||
BOOST_CHECK_EXCEPTION(tfm::format(ConstevalFormatString<2>{"%.*s"}, "hi", "hi"), tfm::format_error,
|
||||
HasReason{"tinyformat: Cannot convert from argument type to integer for use as variable width or precision"});
|
||||
|
||||
// Ensure that tinyformat throws if format string contains wrong number
|
||||
// of specifiers. PassFmt relies on this to verify tinyformat successfully
|
||||
// formats the strings, and will need to be updated if tinyformat is changed
|
||||
|
|
|
@ -15,6 +15,8 @@ import sys
|
|||
FALSE_POSITIVES = [
|
||||
("src/clientversion.cpp", "strprintf(_(COPYRIGHT_HOLDERS), COPYRIGHT_HOLDERS_SUBSTITUTION)"),
|
||||
("src/test/translation_tests.cpp", "strprintf(format, arg)"),
|
||||
("src/test/util_string_tests.cpp", 'tfm::format(ConstevalFormatString<2>{"%*s"}, "hi", "hi")'),
|
||||
("src/test/util_string_tests.cpp", 'tfm::format(ConstevalFormatString<2>{"%.*s"}, "hi", "hi")'),
|
||||
]
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue