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

Side by Side Diff: base/file_path_unittest.cc

Issue 12907: Make FilePath accept FilePath as Append parameter. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 12 years 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 | Annotate | Revision Log
« no previous file with comments | « base/file_path.cc ('k') | no next file » | 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) 2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2008 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/file_path.h" 5 #include "base/file_path.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 // This macro helps avoid wrapped lines in the test structs. 10 // This macro helps avoid wrapped lines in the test structs.
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 { { FPL("c:/"), FPL("") }, FPL("c:/") }, 266 { { FPL("c:/"), FPL("") }, FPL("c:/") },
267 { { FPL("c:/a"), FPL("b") }, FPL("c:/a/b") }, 267 { { FPL("c:/a"), FPL("b") }, FPL("c:/a/b") },
268 { { FPL("c:/a/"), FPL("b") }, FPL("c:/a/b") }, 268 { { FPL("c:/a/"), FPL("b") }, FPL("c:/a/b") },
269 #endif // FILE_PATH_USES_DRIVE_LETTERS 269 #endif // FILE_PATH_USES_DRIVE_LETTERS
270 #endif // FILE_PATH_USES_WIN_SEPARATORS 270 #endif // FILE_PATH_USES_WIN_SEPARATORS
271 }; 271 };
272 272
273 for (size_t i = 0; i < arraysize(cases); ++i) { 273 for (size_t i = 0; i < arraysize(cases); ++i) {
274 FilePath root(cases[i].inputs[0]); 274 FilePath root(cases[i].inputs[0]);
275 FilePath::StringType leaf(cases[i].inputs[1]); 275 FilePath::StringType leaf(cases[i].inputs[1]);
276 FilePath observed = root.Append(leaf); 276 FilePath observed_str = root.Append(leaf);
277 EXPECT_EQ(FilePath::StringType(cases[i].expected), observed.value()) << 277 EXPECT_EQ(FilePath::StringType(cases[i].expected), observed_str.value()) <<
278 "i: " << i << ", root: " << root.value() << ", leaf: " << leaf;
279 FilePath observed_path = root.Append(FilePath(leaf));
280 EXPECT_EQ(FilePath::StringType(cases[i].expected), observed_path.value()) <<
278 "i: " << i << ", root: " << root.value() << ", leaf: " << leaf; 281 "i: " << i << ", root: " << root.value() << ", leaf: " << leaf;
279 } 282 }
280 } 283 }
281 284
282 TEST(FilePathTest, IsAbsolute) { 285 TEST(FilePathTest, IsAbsolute) {
283 const struct UnaryBooleanTestData cases[] = { 286 const struct UnaryBooleanTestData cases[] = {
284 { FPL(""), false }, 287 { FPL(""), false },
285 { FPL("a"), false }, 288 { FPL("a"), false },
286 { FPL("c:"), false }, 289 { FPL("c:"), false },
287 { FPL("c:a"), false }, 290 { FPL("c:a"), false },
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 #endif // FILE_PATH_USES_WIN_SEPARATORS 342 #endif // FILE_PATH_USES_WIN_SEPARATORS
340 }; 343 };
341 344
342 for (size_t i = 0; i < arraysize(cases); ++i) { 345 for (size_t i = 0; i < arraysize(cases); ++i) {
343 FilePath input(cases[i].input); 346 FilePath input(cases[i].input);
344 bool observed = input.IsAbsolute(); 347 bool observed = input.IsAbsolute();
345 EXPECT_EQ(cases[i].expected, observed) << 348 EXPECT_EQ(cases[i].expected, observed) <<
346 "i: " << i << ", input: " << input.value(); 349 "i: " << i << ", input: " << input.value();
347 } 350 }
348 } 351 }
OLDNEW
« no previous file with comments | « base/file_path.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698