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

Unified Diff: tools/gn/test_with_scope.h

Issue 1126193005: Check for inputs not generated by deps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@data
Patch Set: Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gn/target_unittest.cc ('k') | tools/gn/test_with_scope.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/test_with_scope.h
diff --git a/tools/gn/test_with_scope.h b/tools/gn/test_with_scope.h
index 26b082f9fca7358ef9fcdc34e29eaf91c056d81c..79c6a08b32927740bce32db35254875855e982bd 100644
--- a/tools/gn/test_with_scope.h
+++ b/tools/gn/test_with_scope.h
@@ -14,6 +14,7 @@
#include "tools/gn/parse_tree.h"
#include "tools/gn/scope.h"
#include "tools/gn/settings.h"
+#include "tools/gn/target.h"
#include "tools/gn/token.h"
#include "tools/gn/toolchain.h"
#include "tools/gn/value.h"
@@ -35,6 +36,10 @@ class TestWithScope {
// threadsafe so don't write tests that call print from multiple threads.
std::string& print_output() { return print_output_; }
+ // Parse the given string into a label in the default toolchain. This will
+ // assert if the label isn't valid (this is intended for hardcoded labels).
+ Label ParseLabel(const std::string& str) const;
+
// Fills in the tools for the given toolchain with reasonable default values.
// The toolchain in this object will be automatically set up with this
// function, it is exposed to allow tests to get the same functionality for
@@ -82,4 +87,15 @@ class TestParseInput {
DISALLOW_COPY_AND_ASSIGN(TestParseInput);
};
+// Shortcut for creating targets for tests that take the test setup, a pretty-
+// style label, and a target type and sets everything up. The target will
+// default to public visibility.
+class TestTarget : public Target {
+ public:
+ TestTarget(TestWithScope& setup,
+ const std::string& label_string,
+ Target::OutputType type);
+ ~TestTarget() override;
+};
+
#endif // TOOLS_GN_TEST_WITH_SCOPE_H_
« no previous file with comments | « tools/gn/target_unittest.cc ('k') | tools/gn/test_with_scope.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698