From fc35b267ac0b9bc755ada51c7bfb53e1970ac6b0 Mon Sep 17 00:00:00 2001 From: Wyatt Hepler Date: Fri, 24 Jan 2020 17:58:36 -0800 Subject: 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 --- pw_string/format_test.cc | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'pw_string') 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(), "?"); -- cgit v1.2.3