Add strerrordesc_np() and strerrorname_np().
strerrordesc_np() isn't very useful (being just another name for
strerror()), but strerrorname_np() lets you get "ENOSYS" for ENOSYS,
which will make some of our test assertion messages clearer when we
switch over from strerror().
This also adds `%#m` formatting to all the relevant functions.
Test: treehugger
Change-Id: Icfe07a39a307d591c3f4f2a09d008dc021643062
diff --git a/tests/stdio_test.cpp b/tests/stdio_test.cpp
index b0f59bb..eaacc42 100644
--- a/tests/stdio_test.cpp
+++ b/tests/stdio_test.cpp
@@ -2523,6 +2523,24 @@
EXPECT_SWPRINTF(L"<Invalid argument>", L"<%m>");
}
+TEST(STDIO_TEST, printf_hash_m) {
+ errno = 0;
+ EXPECT_SNPRINTF("<0>", "<%#m>");
+ errno = -1;
+ EXPECT_SNPRINTF("<-1>", "<%#m>");
+ errno = EINVAL;
+ EXPECT_SNPRINTF("<EINVAL>", "<%#m>");
+}
+
+TEST(STDIO_TEST, wprintf_hash_m) {
+ errno = 0;
+ EXPECT_SWPRINTF(L"<0>", L"<%#m>");
+ errno = -1;
+ EXPECT_SWPRINTF(L"<-1>", L"<%#m>");
+ errno = EINVAL;
+ EXPECT_SWPRINTF(L"<EINVAL>", L"<%#m>");
+}
+
TEST(STDIO_TEST, printf_m_does_not_clobber_strerror) {
const char* m = strerror(-1);
ASSERT_STREQ("Unknown error -1", m);