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

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

Issue 857163002: Absolute path fixes for gn. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Improve error message Created 5 years, 10 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_unittest.cc ('k') | tools/gn/label.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "testing/gtest/include/gtest/gtest.h" 5 #include "testing/gtest/include/gtest/gtest.h"
6 #include "tools/gn/functions.h" 6 #include "tools/gn/functions.h"
7 #include "tools/gn/test_with_scope.h" 7 #include "tools/gn/test_with_scope.h"
8 8
9 namespace { 9 namespace {
10 10
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 EXPECT_EQ("/", Call("/", "abspath")); 88 EXPECT_EQ("/", Call("/", "abspath"));
89 } 89 }
90 90
91 // Note build dir is "//out/Debug/". 91 // Note build dir is "//out/Debug/".
92 TEST_F(GetPathInfoTest, OutDir) { 92 TEST_F(GetPathInfoTest, OutDir) {
93 EXPECT_EQ("//out/Debug/obj/src/foo/foo", Call("foo/bar.txt", "out_dir")); 93 EXPECT_EQ("//out/Debug/obj/src/foo/foo", Call("foo/bar.txt", "out_dir"));
94 EXPECT_EQ("//out/Debug/obj/src/foo/bar", Call("bar/", "out_dir")); 94 EXPECT_EQ("//out/Debug/obj/src/foo/bar", Call("bar/", "out_dir"));
95 EXPECT_EQ("//out/Debug/obj/src/foo", Call(".", "out_dir")); 95 EXPECT_EQ("//out/Debug/obj/src/foo", Call(".", "out_dir"));
96 EXPECT_EQ("//out/Debug/obj/src/foo", Call("bar", "out_dir")); 96 EXPECT_EQ("//out/Debug/obj/src/foo", Call("bar", "out_dir"));
97 EXPECT_EQ("//out/Debug/obj/foo", Call("//foo/bar.txt", "out_dir")); 97 EXPECT_EQ("//out/Debug/obj/foo", Call("//foo/bar.txt", "out_dir"));
98 // System paths go into the root obj directory. 98 // System paths go into the ABS_PATH obj directory.
99 EXPECT_EQ("//out/Debug/obj", Call("/foo/bar.txt", "out_dir")); 99 EXPECT_EQ("//out/Debug/obj/ABS_PATH/foo", Call("/foo/bar.txt", "out_dir"));
100 #if defined(OS_WIN)
101 EXPECT_EQ("//out/Debug/obj/ABS_PATH/C/foo",
102 Call("/C:/foo/bar.txt", "out_dir"));
103 #endif
100 } 104 }
101 105
102 // Note build dir is "//out/Debug/". 106 // Note build dir is "//out/Debug/".
103 TEST_F(GetPathInfoTest, GenDir) { 107 TEST_F(GetPathInfoTest, GenDir) {
104 EXPECT_EQ("//out/Debug/gen/src/foo/foo", Call("foo/bar.txt", "gen_dir")); 108 EXPECT_EQ("//out/Debug/gen/src/foo/foo", Call("foo/bar.txt", "gen_dir"));
105 EXPECT_EQ("//out/Debug/gen/src/foo/bar", Call("bar/", "gen_dir")); 109 EXPECT_EQ("//out/Debug/gen/src/foo/bar", Call("bar/", "gen_dir"));
106 EXPECT_EQ("//out/Debug/gen/src/foo", Call(".", "gen_dir")); 110 EXPECT_EQ("//out/Debug/gen/src/foo", Call(".", "gen_dir"));
107 EXPECT_EQ("//out/Debug/gen/src/foo", Call("bar", "gen_dir")); 111 EXPECT_EQ("//out/Debug/gen/src/foo", Call("bar", "gen_dir"));
108 EXPECT_EQ("//out/Debug/gen/foo", Call("//foo/bar.txt", "gen_dir")); 112 EXPECT_EQ("//out/Debug/gen/foo", Call("//foo/bar.txt", "gen_dir"));
109 // System paths go into the root obj directory. 113 // System paths go into the root obj directory.
110 EXPECT_EQ("//out/Debug/gen", Call("/foo/bar.txt", "gen_dir")); 114 EXPECT_EQ("//out/Debug/gen", Call("/foo/bar.txt", "gen_dir"));
111 } 115 }
OLDNEW
« no previous file with comments | « tools/gn/filesystem_utils_unittest.cc ('k') | tools/gn/label.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698