Index: tools/gn/test_with_scope.cc |
diff --git a/tools/gn/test_with_scope.cc b/tools/gn/test_with_scope.cc |
index 62849afbf1542bef2e4e55086e7eb7c289a98955..847af62e2787905ac83e9e4e3546372810bf9cff 100644 |
--- a/tools/gn/test_with_scope.cc |
+++ b/tools/gn/test_with_scope.cc |
@@ -39,6 +39,14 @@ TestWithScope::TestWithScope() |
TestWithScope::~TestWithScope() { |
} |
+Label TestWithScope::ParseLabel(const std::string& str) const { |
+ Err err; |
+ Label result = Label::Resolve(SourceDir("//"), toolchain_.label(), |
+ Value(nullptr, str), &err); |
+ CHECK(!err.has_error()); |
+ return result; |
+} |
+ |
// static |
void TestWithScope::SetupToolchain(Toolchain* toolchain) { |
Err err; |
@@ -139,3 +147,15 @@ TestParseInput::TestParseInput(const std::string& input) |
TestParseInput::~TestParseInput() { |
} |
+ |
+TestTarget::TestTarget(TestWithScope& setup, |
+ const std::string& label_string, |
+ Target::OutputType type) |
+ : Target(setup.settings(), setup.ParseLabel(label_string)) { |
+ visibility().SetPublic(); |
+ set_output_type(type); |
+ SetToolchain(setup.toolchain()); |
+} |
+ |
+TestTarget::~TestTarget() { |
+} |