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

Unified Diff: tools/gn/action_target_generator_unittest.cc

Issue 429423002: Refactor GN source expansions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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/action_target_generator.cc ('k') | tools/gn/action_values.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/action_target_generator_unittest.cc
diff --git a/tools/gn/action_target_generator_unittest.cc b/tools/gn/action_target_generator_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..8f3e4d4c3327755c146fa3d1dc54c5877d3f56e8
--- /dev/null
+++ b/tools/gn/action_target_generator_unittest.cc
@@ -0,0 +1,42 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "testing/gtest/include/gtest/gtest.h"
+#include "tools/gn/scheduler.h"
+#include "tools/gn/test_with_scope.h"
+
+// Tests that actions can't have output substitutions.
+TEST(ActionTargetGenerator, ActionOutputSubstitutions) {
+ Scheduler scheduler;
+ TestWithScope setup;
+ Scope::ItemVector items_;
+ setup.scope()->set_item_collector(&items_);
+
+ // First test one with no substitutions, this should be valid.
+ TestParseInput input_good(
+ "action(\"foo\") {\n"
+ " script = \"//foo.py\"\n"
+ " sources = [ \"//bar.txt\" ]\n"
+ " outputs = [ \"//out/Debug/one.txt\" ]\n"
+ "}");
+ ASSERT_FALSE(input_good.has_error());
+
+ // This should run fine.
+ Err err;
+ input_good.parsed()->Execute(setup.scope(), &err);
+ ASSERT_FALSE(err.has_error()) << err.message();
+
+ // Same thing with a pattern in the output should fail.
+ TestParseInput input_bad(
+ "action(\"foo\") {\n"
+ " script = \"//foo.py\"\n"
+ " sources = [ \"//bar.txt\" ]\n"
+ " outputs = [ \"//out/Debug/{{source_name_part}}.txt\" ]\n"
+ "}");
+ ASSERT_FALSE(input_bad.has_error());
+
+ // This should run fine.
+ input_bad.parsed()->Execute(setup.scope(), &err);
+ ASSERT_TRUE(err.has_error());
+}
« no previous file with comments | « tools/gn/action_target_generator.cc ('k') | tools/gn/action_values.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698