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

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

Issue 857163002: Absolute path fixes for gn. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
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/strings/string_util.h" 6 #include "base/strings/string_util.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "tools/gn/filesystem_utils.h" 10 #include "tools/gn/filesystem_utils.h"
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 EXPECT_EQ("two/obj/", 498 EXPECT_EQ("two/obj/",
499 GetOutputDirForSourceDirAsOutputFile( 499 GetOutputDirForSourceDirAsOutputFile(
500 &other_settings, SourceDir("//")).value()); 500 &other_settings, SourceDir("//")).value());
501 501
502 EXPECT_EQ("//out/Debug/two/obj/foo/bar/", 502 EXPECT_EQ("//out/Debug/two/obj/foo/bar/",
503 GetOutputDirForSourceDir(&other_settings, 503 GetOutputDirForSourceDir(&other_settings,
504 SourceDir("//foo/bar/")).value()); 504 SourceDir("//foo/bar/")).value());
505 EXPECT_EQ("two/obj/foo/bar/", 505 EXPECT_EQ("two/obj/foo/bar/",
506 GetOutputDirForSourceDirAsOutputFile( 506 GetOutputDirForSourceDirAsOutputFile(
507 &other_settings, SourceDir("//foo/bar/")).value()); 507 &other_settings, SourceDir("//foo/bar/")).value());
508
509 // Absolute source path
510 EXPECT_EQ("//out/Debug/obj/ABS_PATH/abs/",
511 GetOutputDirForSourceDir(
512 &default_settings, SourceDir("/abs")).value());
513 EXPECT_EQ("obj/ABS_PATH/abs/",
514 GetOutputDirForSourceDirAsOutputFile(
515 &default_settings, SourceDir("/abs")).value());
508 } 516 }
509 517
510 TEST(FilesystemUtils, GetGenDirForSourceDir) { 518 TEST(FilesystemUtils, GetGenDirForSourceDir) {
511 BuildSettings build_settings; 519 BuildSettings build_settings;
512 build_settings.SetBuildDir(SourceDir("//out/Debug/")); 520 build_settings.SetBuildDir(SourceDir("//out/Debug/"));
513 521
514 // Test the default toolchain. 522 // Test the default toolchain.
515 Settings default_settings(&build_settings, ""); 523 Settings default_settings(&build_settings, "");
516 EXPECT_EQ("//out/Debug/gen/", 524 EXPECT_EQ("//out/Debug/gen/",
517 GetGenDirForSourceDir( 525 GetGenDirForSourceDir(
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 EXPECT_EQ("gen/", GetToolchainGenDirAsOutputFile(&settings).value()); 575 EXPECT_EQ("gen/", GetToolchainGenDirAsOutputFile(&settings).value());
568 EXPECT_EQ("//obj/", 576 EXPECT_EQ("//obj/",
569 GetOutputDirForSourceDir(&settings, SourceDir("//")).value()); 577 GetOutputDirForSourceDir(&settings, SourceDir("//")).value());
570 EXPECT_EQ("obj/", 578 EXPECT_EQ("obj/",
571 GetOutputDirForSourceDirAsOutputFile( 579 GetOutputDirForSourceDirAsOutputFile(
572 &settings, SourceDir("//")).value()); 580 &settings, SourceDir("//")).value());
573 EXPECT_EQ("gen/", 581 EXPECT_EQ("gen/",
574 GetGenDirForSourceDirAsOutputFile( 582 GetGenDirForSourceDirAsOutputFile(
575 &settings, SourceDir("//")).value()); 583 &settings, SourceDir("//")).value());
576 } 584 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698