| 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());
|
| +}
|
|
|