summaryrefslogtreecommitdiffstats
path: root/tools/gn/ninja_target_writer_unittest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'tools/gn/ninja_target_writer_unittest.cc')
-rw-r--r--tools/gn/ninja_target_writer_unittest.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/gn/ninja_target_writer_unittest.cc b/tools/gn/ninja_target_writer_unittest.cc
index fe4c9a6..354170a 100644
--- a/tools/gn/ninja_target_writer_unittest.cc
+++ b/tools/gn/ninja_target_writer_unittest.cc
@@ -6,6 +6,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "tools/gn/ninja_target_writer.h"
+#include "tools/gn/target.h"
#include "tools/gn/test_with_scope.h"
namespace {
@@ -15,7 +16,7 @@ class TestingNinjaTargetWriter : public NinjaTargetWriter {
TestingNinjaTargetWriter(const Target* target,
const Toolchain* toolchain,
std::ostream& out)
- : NinjaTargetWriter(target, toolchain, out) {
+ : NinjaTargetWriter(target, out) {
}
virtual void Run() OVERRIDE {}
@@ -35,12 +36,14 @@ TEST(NinjaTargetWriter, WriteInputDepsStampAndGetDep) {
// Make a base target that's a hard dep (action).
Target base_target(setup.settings(), Label(SourceDir("//foo/"), "base"));
base_target.set_output_type(Target::ACTION);
+ base_target.SetToolchain(setup.toolchain());
base_target.action_values().set_script(SourceFile("//foo/script.py"));
// Dependent target that also includes a source prerequisite (should get
// included) and a source (should not be included).
Target target(setup.settings(), Label(SourceDir("//foo/"), "target"));
target.set_output_type(Target::EXECUTABLE);
+ target.SetToolchain(setup.toolchain());
target.inputs().push_back(SourceFile("//foo/input.txt"));
target.sources().push_back(SourceFile("//foo/source.txt"));
target.deps().push_back(LabelTargetPair(&base_target));
@@ -49,6 +52,7 @@ TEST(NinjaTargetWriter, WriteInputDepsStampAndGetDep) {
// inputs.
Target action(setup.settings(), Label(SourceDir("//foo/"), "action"));
action.set_output_type(Target::ACTION);
+ action.SetToolchain(setup.toolchain());
action.action_values().set_script(SourceFile("//foo/script.py"));
action.sources().push_back(SourceFile("//foo/action_source.txt"));
action.deps().push_back(LabelTargetPair(&target));
@@ -109,11 +113,15 @@ TEST(NinjaTargetWriter, WriteInputDepsStampAndGetDepWithToolchainDeps) {
Target toolchain_dep_target(setup.settings(),
Label(SourceDir("//foo/"), "setup"));
toolchain_dep_target.set_output_type(Target::ACTION);
+ toolchain_dep_target.SetToolchain(setup.toolchain());
+ toolchain_dep_target.OnResolved();
setup.toolchain()->deps().push_back(LabelTargetPair(&toolchain_dep_target));
// Make a binary target
Target target(setup.settings(), Label(SourceDir("//foo/"), "target"));
target.set_output_type(Target::EXECUTABLE);
+ target.SetToolchain(setup.toolchain());
+ target.OnResolved();
std::ostringstream stream;
TestingNinjaTargetWriter writer(&target, setup.toolchain(), stream);