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

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

Issue 247663006: Add more phony rules to GN build (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tests Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « tools/gn/filesystem_utils.cc ('k') | tools/gn/ninja_action_target_writer_unittest.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/strings/string_util.h" 5 #include "base/strings/string_util.h"
6 #include "base/strings/utf_string_conversions.h" 6 #include "base/strings/utf_string_conversions.h"
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "tools/gn/filesystem_utils.h" 9 #include "tools/gn/filesystem_utils.h"
10 10
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 std::string input; 66 std::string input;
67 EXPECT_EQ("", FindDir(&input)); 67 EXPECT_EQ("", FindDir(&input));
68 input = "/"; 68 input = "/";
69 EXPECT_EQ("/", FindDir(&input)); 69 EXPECT_EQ("/", FindDir(&input));
70 input = "foo/"; 70 input = "foo/";
71 EXPECT_EQ("foo/", FindDir(&input)); 71 EXPECT_EQ("foo/", FindDir(&input));
72 input = "foo/bar/baz"; 72 input = "foo/bar/baz";
73 EXPECT_EQ("foo/bar/", FindDir(&input)); 73 EXPECT_EQ("foo/bar/", FindDir(&input));
74 } 74 }
75 75
76 TEST(FilesystemUtils, FindLastDirComponent) {
77 SourceDir empty;
78 EXPECT_EQ("", FindLastDirComponent(empty));
79
80 SourceDir root("/");
81 EXPECT_EQ("", FindLastDirComponent(root));
82
83 SourceDir srcroot("//");
84 EXPECT_EQ("", FindLastDirComponent(srcroot));
85
86 SourceDir regular1("//foo/");
87 EXPECT_EQ("foo", FindLastDirComponent(regular1));
88
89 SourceDir regular2("//foo/bar/");
90 EXPECT_EQ("bar", FindLastDirComponent(regular2));
91 }
92
76 TEST(FilesystemUtils, IsPathAbsolute) { 93 TEST(FilesystemUtils, IsPathAbsolute) {
77 EXPECT_TRUE(IsPathAbsolute("/foo/bar")); 94 EXPECT_TRUE(IsPathAbsolute("/foo/bar"));
78 EXPECT_TRUE(IsPathAbsolute("/")); 95 EXPECT_TRUE(IsPathAbsolute("/"));
79 EXPECT_FALSE(IsPathAbsolute("")); 96 EXPECT_FALSE(IsPathAbsolute(""));
80 EXPECT_FALSE(IsPathAbsolute("//")); 97 EXPECT_FALSE(IsPathAbsolute("//"));
81 EXPECT_FALSE(IsPathAbsolute("//foo/bar")); 98 EXPECT_FALSE(IsPathAbsolute("//foo/bar"));
82 99
83 #if defined(OS_WIN) 100 #if defined(OS_WIN)
84 EXPECT_TRUE(IsPathAbsolute("C:/foo")); 101 EXPECT_TRUE(IsPathAbsolute("C:/foo"));
85 EXPECT_TRUE(IsPathAbsolute("C:/")); 102 EXPECT_TRUE(IsPathAbsolute("C:/"));
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 build_settings.SetBuildDir(SourceDir("//")); 392 build_settings.SetBuildDir(SourceDir("//"));
376 Settings settings(&build_settings, ""); 393 Settings settings(&build_settings, "");
377 394
378 EXPECT_EQ("//", GetToolchainOutputDir(&settings).value()); 395 EXPECT_EQ("//", GetToolchainOutputDir(&settings).value());
379 EXPECT_EQ("//gen/", GetToolchainGenDir(&settings).value()); 396 EXPECT_EQ("//gen/", GetToolchainGenDir(&settings).value());
380 EXPECT_EQ("//obj/", 397 EXPECT_EQ("//obj/",
381 GetOutputDirForSourceDir(&settings, SourceDir("//")).value()); 398 GetOutputDirForSourceDir(&settings, SourceDir("//")).value());
382 EXPECT_EQ("//gen/", 399 EXPECT_EQ("//gen/",
383 GetGenDirForSourceDir(&settings, SourceDir("//")).value()); 400 GetGenDirForSourceDir(&settings, SourceDir("//")).value());
384 } 401 }
OLDNEW
« no previous file with comments | « tools/gn/filesystem_utils.cc ('k') | tools/gn/ninja_action_target_writer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698