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

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

Issue 2561963002: base: Remove the string logging from CHECK(). (Closed)
Patch Set: checkstring: rebase Created 4 years 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
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 "tools/gn/test_with_scope.h" 5 #include "tools/gn/test_with_scope.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "tools/gn/parser.h" 10 #include "tools/gn/parser.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 *err = input.parse_err(); 53 *err = input.parse_err();
54 return false; 54 return false;
55 } 55 }
56 56
57 size_t first_item = items_.size(); 57 size_t first_item = items_.size();
58 input.parsed()->Execute(&scope_, err); 58 input.parsed()->Execute(&scope_, err);
59 if (err->has_error()) 59 if (err->has_error())
60 return false; 60 return false;
61 61
62 for (size_t i = first_item; i < items_.size(); ++i) { 62 for (size_t i = first_item; i < items_.size(); ++i) {
63 CHECK(items_[i]->AsTarget() != nullptr) 63 // Only targets are supported in ExecuteSnippet()
64 << "Only targets are supported in ExecuteSnippet()"; 64 CHECK(items_[i]->AsTarget() != nullptr);
65 items_[i]->AsTarget()->SetToolchain(&toolchain_); 65 items_[i]->AsTarget()->SetToolchain(&toolchain_);
66 if (!items_[i]->OnResolved(err)) 66 if (!items_[i]->OnResolved(err))
67 return false; 67 return false;
68 } 68 }
69 return true; 69 return true;
70 } 70 }
71 71
72 // static 72 // static
73 void TestWithScope::SetupToolchain(Toolchain* toolchain) { 73 void TestWithScope::SetupToolchain(Toolchain* toolchain) {
74 Err err; 74 Err err;
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 std::move(compile_xcassets_tool)); 183 std::move(compile_xcassets_tool));
184 184
185 toolchain->ToolchainSetupComplete(); 185 toolchain->ToolchainSetupComplete();
186 } 186 }
187 187
188 // static 188 // static
189 void TestWithScope::SetCommandForTool(const std::string& cmd, Tool* tool) { 189 void TestWithScope::SetCommandForTool(const std::string& cmd, Tool* tool) {
190 Err err; 190 Err err;
191 SubstitutionPattern command; 191 SubstitutionPattern command;
192 command.Parse(cmd, nullptr, &err); 192 command.Parse(cmd, nullptr, &err);
193 CHECK(!err.has_error()) 193 LOG_IF(FATAL, err.has_error()) << "Couldn't parse \"" << cmd << "\", "
194 << "Couldn't parse \"" << cmd << "\", " << "got " << err.message(); 194 << "got " << err.message();
195 tool->set_command(command); 195 tool->set_command(command);
196 } 196 }
197 197
198 void TestWithScope::AppendPrintOutput(const std::string& str) { 198 void TestWithScope::AppendPrintOutput(const std::string& str) {
199 print_output_.append(str); 199 print_output_.append(str);
200 } 200 }
201 201
202 TestParseInput::TestParseInput(const std::string& input) 202 TestParseInput::TestParseInput(const std::string& input)
203 : input_file_(SourceFile("//test")) { 203 : input_file_(SourceFile("//test")) {
204 input_file_.SetContents(input); 204 input_file_.SetContents(input);
(...skipping 10 matching lines...) Expand all
215 const std::string& label_string, 215 const std::string& label_string,
216 Target::OutputType type) 216 Target::OutputType type)
217 : Target(setup.settings(), setup.ParseLabel(label_string)) { 217 : Target(setup.settings(), setup.ParseLabel(label_string)) {
218 visibility().SetPublic(); 218 visibility().SetPublic();
219 set_output_type(type); 219 set_output_type(type);
220 SetToolchain(setup.toolchain()); 220 SetToolchain(setup.toolchain());
221 } 221 }
222 222
223 TestTarget::~TestTarget() { 223 TestTarget::~TestTarget() {
224 } 224 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698