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

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

Issue 1155713006: GN: Make file/dir resolving return errors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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/commands.cc ('k') | tools/gn/function_exec_script.cc » ('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) 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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 EXPECT_EQ("../../..", input); 229 EXPECT_EQ("../../..", input);
230 230
231 input = "../"; 231 input = "../";
232 NormalizePath(&input); 232 NormalizePath(&input);
233 EXPECT_EQ("../", input); 233 EXPECT_EQ("../", input);
234 234
235 // Backslash normalization. 235 // Backslash normalization.
236 input = "foo\\..\\..\\bar"; 236 input = "foo\\..\\..\\bar";
237 NormalizePath(&input); 237 NormalizePath(&input);
238 EXPECT_EQ("../bar", input); 238 EXPECT_EQ("../bar", input);
239
240 // Trailing slashes should get preserved.
241 input = "//foo/bar/";
242 NormalizePath(&input);
243 EXPECT_EQ("//foo/bar/", input);
239 } 244 }
240 245
241 TEST(FilesystemUtils, RebasePath) { 246 TEST(FilesystemUtils, RebasePath) {
242 base::StringPiece source_root("/source/root"); 247 base::StringPiece source_root("/source/root");
243 248
244 // Degenerate case. 249 // Degenerate case.
245 EXPECT_EQ(".", RebasePath("//", SourceDir("//"), source_root)); 250 EXPECT_EQ(".", RebasePath("//", SourceDir("//"), source_root));
246 EXPECT_EQ(".", RebasePath("//foo/bar/", SourceDir("//foo/bar/"), 251 EXPECT_EQ(".", RebasePath("//foo/bar/", SourceDir("//foo/bar/"),
247 source_root)); 252 source_root));
248 253
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 EXPECT_EQ("gen/", GetToolchainGenDirAsOutputFile(&settings).value()); 588 EXPECT_EQ("gen/", GetToolchainGenDirAsOutputFile(&settings).value());
584 EXPECT_EQ("//obj/", 589 EXPECT_EQ("//obj/",
585 GetOutputDirForSourceDir(&settings, SourceDir("//")).value()); 590 GetOutputDirForSourceDir(&settings, SourceDir("//")).value());
586 EXPECT_EQ("obj/", 591 EXPECT_EQ("obj/",
587 GetOutputDirForSourceDirAsOutputFile( 592 GetOutputDirForSourceDirAsOutputFile(
588 &settings, SourceDir("//")).value()); 593 &settings, SourceDir("//")).value());
589 EXPECT_EQ("gen/", 594 EXPECT_EQ("gen/",
590 GetGenDirForSourceDirAsOutputFile( 595 GetGenDirForSourceDirAsOutputFile(
591 &settings, SourceDir("//")).value()); 596 &settings, SourceDir("//")).value());
592 } 597 }
OLDNEW
« no previous file with comments | « tools/gn/commands.cc ('k') | tools/gn/function_exec_script.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698