Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: base/string_split_unittest.cc

Issue 3366011: base: Move SplitStringDontTrim functions from string_util.h to string_split.h (Closed) Base URL: git://git.chromium.org/chromium.git
Patch Set: remove dchecks Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/string_split.cc ('k') | base/string_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/string_split.h" 5 #include "base/string_split.h"
6 #include "testing/gmock/include/gmock/gmock.h" 6 #include "testing/gmock/include/gmock/gmock.h"
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 using ::testing::ElementsAre; 9 using ::testing::ElementsAre;
10 10
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 std::vector<std::string> results; 170 std::vector<std::string> results;
171 SplitStringUsingSubstr( 171 SplitStringUsingSubstr(
172 "unDELIMITERdeuxDELIMITERtroisDELIMITERquatreDELIMITERDELIMITERDELIMITER", 172 "unDELIMITERdeuxDELIMITERtroisDELIMITERquatreDELIMITERDELIMITERDELIMITER",
173 "DELIMITER", 173 "DELIMITER",
174 &results); 174 &results);
175 ASSERT_EQ(7u, results.size()); 175 ASSERT_EQ(7u, results.size());
176 EXPECT_THAT( 176 EXPECT_THAT(
177 results, ElementsAre("un", "deux", "trois", "quatre", "", "", "")); 177 results, ElementsAre("un", "deux", "trois", "quatre", "", "", ""));
178 } 178 }
179 179
180 TEST(StringSplitTest, StringSplitDontTrim) {
181 std::vector<std::wstring> r;
182
183 SplitStringDontTrim(L"\t\ta\t", L'\t', &r);
184 ASSERT_EQ(4U, r.size());
185 EXPECT_EQ(r[0], L"");
186 EXPECT_EQ(r[1], L"");
187 EXPECT_EQ(r[2], L"a");
188 EXPECT_EQ(r[3], L"");
189 r.clear();
190
191 SplitStringDontTrim(L"\ta\t\nb\tcc", L'\n', &r);
192 ASSERT_EQ(2U, r.size());
193 EXPECT_EQ(r[0], L"\ta\t");
194 EXPECT_EQ(r[1], L"b\tcc");
195 r.clear();
196 }
197
180 } // namespace base 198 } // namespace base
OLDNEW
« no previous file with comments | « base/string_split.cc ('k') | base/string_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698