| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" |
| 6 #include "tools/gn/functions.h" | 6 #include "tools/gn/functions.h" |
| 7 #include "tools/gn/target.h" | 7 #include "tools/gn/target.h" |
| 8 #include "tools/gn/test_with_scope.h" | 8 #include "tools/gn/test_with_scope.h" |
| 9 | 9 |
| 10 namespace { | 10 namespace { |
| 11 | 11 |
| 12 class GetTargetOutputsTest : public testing::Test { | 12 class GetTargetOutputsTest : public testing::Test { |
| 13 public: | 13 public: |
| 14 GetTargetOutputsTest() { | 14 GetTargetOutputsTest() { |
| 15 // Want consistent target names so explicitly set platform. | |
| 16 setup_.settings()->set_target_os(Settings::LINUX); | |
| 17 setup_.scope()->set_item_collector(&items_); | 15 setup_.scope()->set_item_collector(&items_); |
| 18 } | 16 } |
| 19 | 17 |
| 20 Value GetTargetOutputs(const std::string& name, Err* err) { | 18 Value GetTargetOutputs(const std::string& name, Err* err) { |
| 21 FunctionCallNode function; | 19 FunctionCallNode function; |
| 22 std::vector<Value> args; | 20 std::vector<Value> args; |
| 23 args.push_back(Value(nullptr, name)); | 21 args.push_back(Value(nullptr, name)); |
| 24 return functions::RunGetTargetOutputs(setup_.scope(), &function, args, err); | 22 return functions::RunGetTargetOutputs(setup_.scope(), &function, args, err); |
| 25 } | 23 } |
| 26 | 24 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 "//out/Debug/{{source_file_part}}.two"); | 95 "//out/Debug/{{source_file_part}}.two"); |
| 98 | 96 |
| 99 items_.push_back(action); | 97 items_.push_back(action); |
| 100 | 98 |
| 101 Err err; | 99 Err err; |
| 102 Value result = GetTargetOutputs("//foo:bar", &err); | 100 Value result = GetTargetOutputs("//foo:bar", &err); |
| 103 ASSERT_FALSE(err.has_error()); | 101 ASSERT_FALSE(err.has_error()); |
| 104 AssertTwoStringsEqual(result, "//out/Debug/file.txt.one", | 102 AssertTwoStringsEqual(result, "//out/Debug/file.txt.one", |
| 105 "//out/Debug/file.txt.two"); | 103 "//out/Debug/file.txt.two"); |
| 106 } | 104 } |
| OLD | NEW |