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

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

Issue 1958783003: GN: Prefer toplevel targets for phony names. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments Created 4 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
« no previous file with comments | « tools/gn/ninja_build_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 <sstream> 5 #include <sstream>
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "tools/gn/ninja_build_writer.h" 8 #include "tools/gn/ninja_build_writer.h"
9 #include "tools/gn/scheduler.h" 9 #include "tools/gn/scheduler.h"
10 #include "tools/gn/target.h" 10 #include "tools/gn/target.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 " depfile = build.ninja.d\n" 46 " depfile = build.ninja.d\n"
47 "\n"; 47 "\n";
48 const char expected_link_pool[] = 48 const char expected_link_pool[] =
49 "pool link_pool\n" 49 "pool link_pool\n"
50 " depth = 0\n" 50 " depth = 0\n"
51 "\n"; 51 "\n";
52 const char expected_toolchain[] = 52 const char expected_toolchain[] =
53 "subninja toolchain.ninja\n" 53 "subninja toolchain.ninja\n"
54 "\n"; 54 "\n";
55 const char expected_targets[] = 55 const char expected_targets[] =
56 "build bar: phony obj/bar/bar.stamp\n"
56 "build foo$:bar: phony obj/foo/bar.stamp\n" 57 "build foo$:bar: phony obj/foo/bar.stamp\n"
57 "build bar$:bar: phony obj/bar/bar.stamp\n" 58 "build bar$:bar: phony obj/bar/bar.stamp\n"
58 "build bar: phony obj/bar/bar.stamp\n"
59 "\n"; 59 "\n";
60 const char expected_root_target[] = 60 const char expected_root_target[] =
61 "build all: phony obj/foo/bar.stamp $\n" 61 "build all: phony $\n"
62 " obj/foo/bar.stamp $\n"
62 " obj/bar/bar.stamp\n" 63 " obj/bar/bar.stamp\n"
64 "\n"
63 "default all\n"; 65 "default all\n";
64 std::string out_str = ninja_out.str(); 66 std::string out_str = ninja_out.str();
65 #define EXPECT_SNIPPET(expected) \ 67 #define EXPECT_SNIPPET(expected) \
66 EXPECT_NE(std::string::npos, out_str.find(expected)) << \ 68 EXPECT_NE(std::string::npos, out_str.find(expected)) << \
67 "Expected to find: " << expected << std::endl << \ 69 "Expected to find: " << expected << std::endl << \
68 "Within: " << out_str 70 "Within: " << out_str
69 EXPECT_SNIPPET(expected_rule_gn); 71 EXPECT_SNIPPET(expected_rule_gn);
70 EXPECT_SNIPPET(expected_build_ninja); 72 EXPECT_SNIPPET(expected_build_ninja);
71 EXPECT_SNIPPET(expected_link_pool); 73 EXPECT_SNIPPET(expected_link_pool);
72 EXPECT_SNIPPET(expected_toolchain); 74 EXPECT_SNIPPET(expected_toolchain);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 "\n" 112 "\n"
111 "This is can often be fixed by changing one of the target names, or by \n" 113 "This is can often be fixed by changing one of the target names, or by \n"
112 "setting an output_name on one of them.\n" 114 "setting an output_name on one of them.\n"
113 "\n" 115 "\n"
114 "Collisions:\n" 116 "Collisions:\n"
115 " //foo:bar\n" 117 " //foo:bar\n"
116 " //bar:bar\n"; 118 " //bar:bar\n";
117 119
118 EXPECT_EQ(expected_help_test, err.help_text()); 120 EXPECT_EQ(expected_help_test, err.help_text());
119 } 121 }
OLDNEW
« no previous file with comments | « tools/gn/ninja_build_writer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698