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

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

Issue 1734083002: GN: Visual Studio generator does not depend on is_debug variable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment fix Created 4 years, 9 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/visual_studio_writer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "tools/gn/visual_studio_writer.h" 5 #include "tools/gn/visual_studio_writer.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "tools/gn/test_with_scope.h" 8 #include "tools/gn/test_with_scope.h"
9 #include "tools/gn/visual_studio_utils.h" 9 #include "tools/gn/visual_studio_utils.h"
10 10
11 namespace { 11 namespace {
12 12
13 class VisualStudioWriterTest : public testing::Test { 13 class VisualStudioWriterTest : public testing::Test {
14 protected: 14 protected:
15 TestWithScope setup_; 15 TestWithScope setup_;
16 }; 16 };
17 17
18 std::string MakeTestPath(const std::string& path) { 18 std::string MakeTestPath(const std::string& path) {
19 #if defined(OS_WIN) 19 #if defined(OS_WIN)
20 return "C:" + path; 20 return "C:" + path;
21 #else 21 #else
22 return path; 22 return path;
23 #endif 23 #endif
24 } 24 }
25 25
26 } // namespace 26 } // namespace
27 27
28 TEST_F(VisualStudioWriterTest, ResolveSolutionFolders) { 28 TEST_F(VisualStudioWriterTest, ResolveSolutionFolders) {
29 VisualStudioWriter writer(setup_.build_settings(), true, "Win32", 29 VisualStudioWriter writer(setup_.build_settings(), "Win32",
30 VisualStudioWriter::Version::Vs2015); 30 VisualStudioWriter::Version::Vs2015);
31 31
32 std::string path = 32 std::string path =
33 MakeTestPath("/foo/chromium/src/out/Debug/obj/base/base.vcxproj"); 33 MakeTestPath("/foo/chromium/src/out/Debug/obj/base/base.vcxproj");
34 writer.projects_.push_back(new VisualStudioWriter::SolutionProject( 34 writer.projects_.push_back(new VisualStudioWriter::SolutionProject(
35 "base", path, MakeGuid(path, "project"), 35 "base", path, MakeGuid(path, "project"),
36 MakeTestPath("/foo/chromium/src/base"), "Win32")); 36 MakeTestPath("/foo/chromium/src/base"), "Win32"));
37 37
38 path = MakeTestPath("/foo/chromium/src/out/Debug/obj/tools/gn/gn.vcxproj"); 38 path = MakeTestPath("/foo/chromium/src/out/Debug/obj/tools/gn/gn.vcxproj");
39 writer.projects_.push_back(new VisualStudioWriter::SolutionProject( 39 writer.projects_.push_back(new VisualStudioWriter::SolutionProject(
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 writer.folders_[3]->path); 73 writer.folders_[3]->path);
74 ASSERT_EQ(writer.folders_[2], writer.folders_[3]->parent_folder); 74 ASSERT_EQ(writer.folders_[2], writer.folders_[3]->parent_folder);
75 75
76 ASSERT_EQ(writer.folders_[0], writer.projects_[0]->parent_folder); 76 ASSERT_EQ(writer.folders_[0], writer.projects_[0]->parent_folder);
77 ASSERT_EQ(writer.folders_[3], writer.projects_[1]->parent_folder); 77 ASSERT_EQ(writer.folders_[3], writer.projects_[1]->parent_folder);
78 ASSERT_EQ(writer.folders_[1], writer.projects_[2]->parent_folder); 78 ASSERT_EQ(writer.folders_[1], writer.projects_[2]->parent_folder);
79 ASSERT_EQ(writer.folders_[0], writer.projects_[3]->parent_folder); 79 ASSERT_EQ(writer.folders_[0], writer.projects_[3]->parent_folder);
80 } 80 }
81 81
82 TEST_F(VisualStudioWriterTest, ResolveSolutionFolders_AbsPath) { 82 TEST_F(VisualStudioWriterTest, ResolveSolutionFolders_AbsPath) {
83 VisualStudioWriter writer(setup_.build_settings(), true, "Win32", 83 VisualStudioWriter writer(setup_.build_settings(), "Win32",
84 VisualStudioWriter::Version::Vs2015); 84 VisualStudioWriter::Version::Vs2015);
85 85
86 std::string path = 86 std::string path =
87 MakeTestPath("/foo/chromium/src/out/Debug/obj/base/base.vcxproj"); 87 MakeTestPath("/foo/chromium/src/out/Debug/obj/base/base.vcxproj");
88 writer.projects_.push_back(new VisualStudioWriter::SolutionProject( 88 writer.projects_.push_back(new VisualStudioWriter::SolutionProject(
89 "base", path, MakeGuid(path, "project"), 89 "base", path, MakeGuid(path, "project"),
90 MakeTestPath("/foo/chromium/src/base"), "Win32")); 90 MakeTestPath("/foo/chromium/src/base"), "Win32"));
91 91
92 path = MakeTestPath("/foo/chromium/src/out/Debug/obj/tools/gn/gn.vcxproj"); 92 path = MakeTestPath("/foo/chromium/src/out/Debug/obj/tools/gn/gn.vcxproj");
93 writer.projects_.push_back(new VisualStudioWriter::SolutionProject( 93 writer.projects_.push_back(new VisualStudioWriter::SolutionProject(
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 ASSERT_EQ("gn", writer.folders_[6]->name); 139 ASSERT_EQ("gn", writer.folders_[6]->name);
140 ASSERT_EQ(MakeTestPath("/foo/chromium/src/tools/gn"), 140 ASSERT_EQ(MakeTestPath("/foo/chromium/src/tools/gn"),
141 writer.folders_[6]->path); 141 writer.folders_[6]->path);
142 ASSERT_EQ(writer.folders_[5], writer.folders_[6]->parent_folder); 142 ASSERT_EQ(writer.folders_[5], writer.folders_[6]->parent_folder);
143 143
144 ASSERT_EQ(writer.folders_[4], writer.projects_[0]->parent_folder); 144 ASSERT_EQ(writer.folders_[4], writer.projects_[0]->parent_folder);
145 ASSERT_EQ(writer.folders_[6], writer.projects_[1]->parent_folder); 145 ASSERT_EQ(writer.folders_[6], writer.projects_[1]->parent_folder);
146 ASSERT_EQ(writer.folders_[0], writer.projects_[2]->parent_folder); 146 ASSERT_EQ(writer.folders_[0], writer.projects_[2]->parent_folder);
147 ASSERT_EQ(writer.folders_[1], writer.projects_[3]->parent_folder); 147 ASSERT_EQ(writer.folders_[1], writer.projects_[3]->parent_folder);
148 } 148 }
OLDNEW
« no previous file with comments | « tools/gn/visual_studio_writer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698