Summary: Apparently there is some dispute about the correct thing for `snprintf(buf, len, "bogus%", "foo")` to return. OSX says 5, Linux says -1. The code in `folly/String.cpp` depends on -1 to throw the exception this test was expecting.
Test Plan: make check on OSX
Reviewed By: chip@fb.com
Subscribers: exa, folly-diffs@
FB internal diff:
D1770970
Tasks:
5936226
Signature: t1:
1770970:
1420680750:
bafae2aa8327a52013e68af64a163323244ca03b
va_end(ap);
};
+ // OSX's sprintf family does not return a negative number on a bad format
+ // string, but Linux does. It's unclear to me which behavior is more
+ // correct.
+#if !__APPLE__
EXPECT_THROW({stringVPrintf(fmt, ap);},
std::runtime_error);
+#endif
}
TEST(StringPrintf, VPrintf) {