diff options
Diffstat (limited to 'absl/strings/internal/str_format/bind_test.cc')
-rw-r--r-- | absl/strings/internal/str_format/bind_test.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/absl/strings/internal/str_format/bind_test.cc b/absl/strings/internal/str_format/bind_test.cc index 47575739..ba6470ec 100644 --- a/absl/strings/internal/str_format/bind_test.cc +++ b/absl/strings/internal/str_format/bind_test.cc @@ -1,6 +1,7 @@ #include "absl/strings/internal/str_format/bind.h" #include <string.h> +#include <limits> #include "gtest/gtest.h" @@ -91,6 +92,20 @@ TEST_F(FormatBindTest, BindSingle) { } } +TEST_F(FormatBindTest, WidthUnderflowRegression) { + UnboundConversion props; + BoundConversion bound; + int next = 0; + const int args_i[] = {std::numeric_limits<int>::min(), 17}; + const FormatArgImpl args[] = {FormatArgImpl(args_i[0]), + FormatArgImpl(args_i[1])}; + ASSERT_TRUE(Extract("*d", &props, &next)); + ASSERT_TRUE(BindWithPack(&props, args, &bound)); + + EXPECT_EQ(bound.width(), std::numeric_limits<int>::max()); + EXPECT_EQ(bound.arg(), args + 1); +} + TEST_F(FormatBindTest, FormatPack) { struct Expectation { int line; |