diff options
author | Wyatt Hepler <hepler@google.com> | 2020-01-24 17:58:36 -0800 |
---|---|---|
committer | Wyatt Hepler <hepler@google.com> | 2020-01-24 18:16:08 -0800 |
commit | fc35b267ac0b9bc755ada51c7bfb53e1970ac6b0 (patch) | |
tree | 02ce0672af862b8efb35c9a9919afb742fca7597 /pw_string | |
parent | 4981058686b347632c4348d9371cbc1434008b6a (diff) | |
download | pigweed-fc35b267ac0b9bc755ada51c7bfb53e1970ac6b0.tar.gz |
pw_string: Remove problematic test
Remove a test that attempts to trigger a negative (error) return value
for snprintf. The format strings that trigger these errors vary by
platform, and a format that returns a negative result on one platform
(Linux) may crash another (Windows).
Change-Id: I7b60bc301cd534d0e78228829ea6288687e05c43
Diffstat (limited to 'pw_string')
-rw-r--r-- | pw_string/format_test.cc | 18 |
1 files changed, 0 insertions, 18 deletions
diff --git a/pw_string/format_test.cc b/pw_string/format_test.cc index 1c44c4eaa..ad7e39ec0 100644 --- a/pw_string/format_test.cc +++ b/pw_string/format_test.cc @@ -40,24 +40,6 @@ TEST(Format, ValidFormatStringAndArguments_Succeeds) { EXPECT_STREQ("12345", buffer); } -TEST(Format, InvalidConversionSpecifier_ReturnsInvalidArgumentAndTerminates) { - char buffer[32] = {'?', '?', '?', '?', '\0'}; - - // 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()); - EXPECT_STREQ("", buffer); -} - TEST(Format, EmptyBuffer_ReturnsResourceExhausted) { auto result = Format(span<char>(), "?"); |