fix: promoting uint8_t/int8_t to make it casting result printable (#1132)

The underlying type of uint8_t/int8_t is unsigned char and signed char,
but IOStreams was specified to treat them just like char.

so promoting the casting value to get the expected value.

Signed-off-by: ComixHe <ComixHe1895@outlook.com>
This commit is contained in:
Comix
2025-03-06 12:07:50 +08:00
committed by GitHub
parent 38e370f671
commit 7ff65c16f2
3 changed files with 5 additions and 13 deletions

View File

@@ -38,6 +38,9 @@ TEST_CASE("TypeTools: Streaming", "[helpers]") {
CHECK(std::string("string") == CLI::detail::to_string("string"));
CHECK(std::string("string") == CLI::detail::to_string(std::string("string")));
enum class t1 : std::uint8_t { enum1, enum2 };
CHECK(CLI::detail::to_string(t1::enum1) == "0");
}
TEST_CASE("TypeTools: tuple", "[helpers]") {