Client: cpp
Two cases in ToStringTest call std::locale::global() and never put back what
was there. Setting it is the point -- they prove to_string() does not follow
the global locale, which is why TToString.h imbues a default one on the
streams it builds -- but leaving it set is not. Every stream constructed later
in the same UnitTests binary picks it up, in suites that have nothing to do
with this one, and numbers formatted through an ostringstream come out with
digit grouping.
That has already cost a debugging session. A case in THttpBufferBoundTest
formats a chunk size with "size << std::hex << 4096" and got "1.000" rather
than "1000", so the transport under test read a different stream, and the case
passed or failed depending on whether it ran alone or in a full run --
ToStringTest is disabled by default and only runs when the whole binary does.
A scoped guard restores the previous global locale on exit. The cases still
set the locale for their own duration, so what they assert is unchanged.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
ToStringTest.cpp is a better place than JSONProtoTest.cpp for to_string
tests. Move global locale-related unit tests there.
Also imbue the C locale in the floating point to_string functions to avoid
decimal number strings formatted with comma instead of decimal point.
In Dockerfiles, install de_DE locale because it uses decimal comma.