Explicitly test printf %s with nullptr.

I haven't found a bug, but tests are good.

Bug: https://github.com/landley/toybox/issues/163
Change-Id: I57149800099abc699cc841b69a5a72aeac7c2bcc
diff --git a/tests/stdio_test.cpp b/tests/stdio_test.cpp
index a0cda1b..75abbd2 100644
--- a/tests/stdio_test.cpp
+++ b/tests/stdio_test.cpp
@@ -853,6 +853,20 @@
   ASSERT_EQ(ENOMEM, errno);
 }
 
+// Inspired by https://github.com/landley/toybox/issues/163.
+TEST(STDIO_TEST, printf_NULL) {
+  char buf[128];
+  char* null = nullptr;
+  EXPECT_EQ(4, snprintf(buf, sizeof(buf), "<%*.*s>", 2, 2, null));
+  EXPECT_STREQ("<(n>", buf);
+  EXPECT_EQ(8, snprintf(buf, sizeof(buf), "<%*.*s>", 2, 8, null));
+  EXPECT_STREQ("<(null)>", buf);
+  EXPECT_EQ(10, snprintf(buf, sizeof(buf), "<%*.*s>", 8, 2, null));
+  EXPECT_STREQ("<      (n>", buf);
+  EXPECT_EQ(10, snprintf(buf, sizeof(buf), "<%*.*s>", 8, 8, null));
+  EXPECT_STREQ("<  (null)>", buf);
+}
+
 TEST(STDIO_TEST, fprintf) {
   TemporaryFile tf;