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

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

Issue 21114002: Add initial prototype for the GN meta-buildsystem. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add owners and readme Created 7 years, 4 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/source_dir.cc ('k') | tools/gn/source_file.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "testing/gtest/include/gtest/gtest.h"
6 #include "tools/gn/source_dir.h"
7 #include "tools/gn/source_file.h"
8
9 TEST(SourceDir, ResolveRelativeFile) {
10 SourceDir base("//base/");
11
12 // Empty input is an error.
13 EXPECT_TRUE(base.ResolveRelativeFile("") == SourceFile());
14
15 // These things are directories, so should be an error.
16 EXPECT_TRUE(base.ResolveRelativeFile("//foo/bar/") == SourceFile());
17 EXPECT_TRUE(base.ResolveRelativeFile("bar/") == SourceFile());
18
19 // Absolute paths should be passed unchanged.
20 EXPECT_TRUE(base.ResolveRelativeFile("//foo") == SourceFile("//foo"));
21 EXPECT_TRUE(base.ResolveRelativeFile("/foo") == SourceFile("/foo"));
22
23 // Basic relative stuff.
24 EXPECT_TRUE(base.ResolveRelativeFile("foo") == SourceFile("//base/foo"));
25 EXPECT_TRUE(base.ResolveRelativeFile("./foo") == SourceFile("//base/foo"));
26 EXPECT_TRUE(base.ResolveRelativeFile("../foo") == SourceFile("//foo"));
27 EXPECT_TRUE(base.ResolveRelativeFile("../../foo") == SourceFile("//foo"));
28 }
29
30 TEST(SourceDir, ResolveRelativeDir) {
31 SourceDir base("//base/");
32
33 // Empty input is an error.
34 EXPECT_TRUE(base.ResolveRelativeDir("") == SourceDir());
35
36 // Absolute paths should be passed unchanged.
37 EXPECT_TRUE(base.ResolveRelativeDir("//foo") == SourceDir("//foo/"));
38 EXPECT_TRUE(base.ResolveRelativeDir("/foo") == SourceDir("/foo/"));
39
40 // Basic relative stuff.
41 EXPECT_TRUE(base.ResolveRelativeDir("foo") == SourceDir("//base/foo/"));
42 EXPECT_TRUE(base.ResolveRelativeDir("./foo") == SourceDir("//base/foo/"));
43 EXPECT_TRUE(base.ResolveRelativeDir("../foo") == SourceDir("//foo/"));
44 EXPECT_TRUE(base.ResolveRelativeDir("../../foo/") == SourceDir("//foo/"));
45 }
OLDNEW
« no previous file with comments | « tools/gn/source_dir.cc ('k') | tools/gn/source_file.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698