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

Side by Side Diff: tools/gn/filesystem_utils_unittest.cc

Issue 1817533002: Make rebase_path() aware of Windows drive letter capitalization (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 | « tools/gn/filesystem_utils.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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/files/file_path.h" 5 #include "base/files/file_path.h"
6 #include "base/files/file_util.h" 6 #include "base/files/file_util.h"
7 #include "base/files/scoped_temp_dir.h" 7 #include "base/files/scoped_temp_dir.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/threading/platform_thread.h" 10 #include "base/threading/platform_thread.h"
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 EXPECT_EQ("../../path/to/foo", 481 EXPECT_EQ("../../path/to/foo",
482 RebasePath("/path/to/foo", SourceDir("/source/root"), 482 RebasePath("/path/to/foo", SourceDir("/source/root"),
483 base::StringPiece("/x/y/z"))); 483 base::StringPiece("/x/y/z")));
484 EXPECT_EQ("../../../path/to/foo", 484 EXPECT_EQ("../../../path/to/foo",
485 RebasePath("/path/to/foo", SourceDir("/source/root/a"), 485 RebasePath("/path/to/foo", SourceDir("/source/root/a"),
486 base::StringPiece("/x/y/z"))); 486 base::StringPiece("/x/y/z")));
487 EXPECT_EQ("../../../../path/to/foo", 487 EXPECT_EQ("../../../../path/to/foo",
488 RebasePath("/path/to/foo", SourceDir("/source/root/a/b"), 488 RebasePath("/path/to/foo", SourceDir("/source/root/a/b"),
489 base::StringPiece("/x/y/z"))); 489 base::StringPiece("/x/y/z")));
490 490
491 #if defined(OS_WIN)
492 // Test corrections while rebasing Windows-style absolute paths.
493 EXPECT_EQ("../../../../path/to/foo",
494 RebasePath("C:/path/to/foo", SourceDir("//a/b"),
495 base::StringPiece("/C:/source/root")));
496 EXPECT_EQ("../../../../path/to/foo",
497 RebasePath("/C:/path/to/foo", SourceDir("//a/b"),
498 base::StringPiece("C:/source/root")));
499 EXPECT_EQ("../../../../path/to/foo",
500 RebasePath("/C:/path/to/foo", SourceDir("//a/b"),
501 base::StringPiece("/c:/source/root")));
502 EXPECT_EQ("../../../../path/to/foo",
503 RebasePath("/c:/path/to/foo", SourceDir("//a/b"),
504 base::StringPiece("c:/source/root")));
505 EXPECT_EQ("../../../../path/to/foo",
506 RebasePath("/c:/path/to/foo", SourceDir("//a/b"),
507 base::StringPiece("C:/source/root")));
508 #endif
491 } 509 }
492 510
493 TEST(FilesystemUtils, DirectoryWithNoLastSlash) { 511 TEST(FilesystemUtils, DirectoryWithNoLastSlash) {
494 EXPECT_EQ("", DirectoryWithNoLastSlash(SourceDir())); 512 EXPECT_EQ("", DirectoryWithNoLastSlash(SourceDir()));
495 EXPECT_EQ("/.", DirectoryWithNoLastSlash(SourceDir("/"))); 513 EXPECT_EQ("/.", DirectoryWithNoLastSlash(SourceDir("/")));
496 EXPECT_EQ("//.", DirectoryWithNoLastSlash(SourceDir("//"))); 514 EXPECT_EQ("//.", DirectoryWithNoLastSlash(SourceDir("//")));
497 EXPECT_EQ("//foo", DirectoryWithNoLastSlash(SourceDir("//foo/"))); 515 EXPECT_EQ("//foo", DirectoryWithNoLastSlash(SourceDir("//foo/")));
498 EXPECT_EQ("/bar", DirectoryWithNoLastSlash(SourceDir("/bar/"))); 516 EXPECT_EQ("/bar", DirectoryWithNoLastSlash(SourceDir("/bar/")));
499 } 517 }
500 518
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 EXPECT_EQ("gen/", GetToolchainGenDirAsOutputFile(&settings).value()); 796 EXPECT_EQ("gen/", GetToolchainGenDirAsOutputFile(&settings).value());
779 EXPECT_EQ("//obj/", 797 EXPECT_EQ("//obj/",
780 GetOutputDirForSourceDir(&settings, SourceDir("//")).value()); 798 GetOutputDirForSourceDir(&settings, SourceDir("//")).value());
781 EXPECT_EQ("obj/", 799 EXPECT_EQ("obj/",
782 GetOutputDirForSourceDirAsOutputFile( 800 GetOutputDirForSourceDirAsOutputFile(
783 &settings, SourceDir("//")).value()); 801 &settings, SourceDir("//")).value());
784 EXPECT_EQ("gen/", 802 EXPECT_EQ("gen/",
785 GetGenDirForSourceDirAsOutputFile( 803 GetGenDirForSourceDirAsOutputFile(
786 &settings, SourceDir("//")).value()); 804 &settings, SourceDir("//")).value());
787 } 805 }
OLDNEW
« no previous file with comments | « tools/gn/filesystem_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698