OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/strings/stringprintf.h" | 5 #include "base/strings/stringprintf.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/googletest/include/gtest/gtest.h" |
11 | 11 |
12 namespace base { | 12 namespace base { |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
16 // A helper for the StringAppendV test that follows. | 16 // A helper for the StringAppendV test that follows. |
17 // | 17 // |
18 // Just forwards its args to StringAppendV. | 18 // Just forwards its args to StringAppendV. |
19 static void StringAppendVTestHelper(std::string* out, const char* format, ...) { | 19 static void StringAppendVTestHelper(std::string* out, const char* format, ...) { |
20 va_list ap; | 20 va_list ap; |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 TEST(StringPrintfTest, StringPrintfErrno) { | 171 TEST(StringPrintfTest, StringPrintfErrno) { |
172 errno = 1; | 172 errno = 1; |
173 EXPECT_EQ("", StringPrintf("%s", "")); | 173 EXPECT_EQ("", StringPrintf("%s", "")); |
174 EXPECT_EQ(1, errno); | 174 EXPECT_EQ(1, errno); |
175 std::string out; | 175 std::string out; |
176 StringAppendVTestHelper(&out, "%d foo %s", 1, "bar"); | 176 StringAppendVTestHelper(&out, "%d foo %s", 1, "bar"); |
177 EXPECT_EQ(1, errno); | 177 EXPECT_EQ(1, errno); |
178 } | 178 } |
179 | 179 |
180 } // namespace base | 180 } // namespace base |
OLD | NEW |