pw_string: Fix test for limited snprintfs

snprintf should return a negative number if there is a formatting error.
Limited snprintf implementations may not detect these errors. This
caused the test to fail on the STM32 Discovery F429i.

Change-Id: I1da8593c258508c0d3e2fa6c440a58493ce15597
diff --git a/pw_string/format_test.cc b/pw_string/format_test.cc
index 6beb351..46c78eb 100644
--- a/pw_string/format_test.cc
+++ b/pw_string/format_test.cc
@@ -46,6 +46,12 @@
   // Make the format string volatile to prevent the compiler from potentially
   // checking this as a format string.
   const char* volatile fmt = "abc %9999999999999999999999999999999999d4%s";
+
+  if (std::snprintf(buffer, sizeof(buffer), fmt, 123, "5") >= 0) {
+    // This snprintf implementation does not detect invalid format strings.
+    return;
+  }
+
   auto result = Format(buffer, fmt, 123, "5");
 
   EXPECT_EQ(Status::INVALID_ARGUMENT, result.status());