Fix issue #771 by implementing S conversion specifier for printf-related functions (#786)

* Implement S conversion specifier for printf-related functions

POSIX specifies that a conversion specifier of S must be interpreted
the same way as %ls. This patch implements this.

* clang-format

---------

Co-authored-by: Gavin Hayes <gavin@computoid.com>
This commit is contained in:
Gabriel Ravier 2023-03-25 19:38:21 +01:00 committed by GitHub
parent 58b2f9bd6b
commit 2d6ea2fbc9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View file

@ -64,6 +64,11 @@ TEST(fmt, d) {
EXPECT_STREQ("-2147483648", _gc(xasprintf("% d", INT_MIN)));
}
TEST(fmt, s) {
EXPECT_STREQ("Wide character output test",
_gc(xasprintf("%S", L"Wide character output test")));
}
TEST(fmt, g) {
EXPECT_STREQ("1", _gc(xasprintf("%g", 1.)));
EXPECT_STREQ(" 1", _gc(xasprintf("% g", 1.)));