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

Side by Side Diff: tools/gn/function_toolchain_unittest.cc

Issue 2481423002: Convert gn docstrings to C++11 raw strings. (Closed)
Patch Set: More Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/scheduler.h" 7 #include "tools/gn/scheduler.h"
8 #include "tools/gn/test_with_scope.h" 8 #include "tools/gn/test_with_scope.h"
9 9
10 TEST(FunctionToolchain, RuntimeOutputs) { 10 TEST(FunctionToolchain, RuntimeOutputs) {
11 Scheduler scheduler; 11 Scheduler scheduler;
12 TestWithScope setup; 12 TestWithScope setup;
13 13
14 // These runtime outputs are a subset of the outputs so are OK. 14 // These runtime outputs are a subset of the outputs so are OK.
15 { 15 {
16 TestParseInput input( 16 TestParseInput input(
17 "toolchain(\"good\") {\n" 17 R"(toolchain("good") {
18 " tool(\"link\") {\n" 18 tool("link") {
19 " outputs = [ \"foo\" ]\n" 19 outputs = [ "foo" ]
20 " runtime_outputs = [ \"foo\" ]\n" 20 runtime_outputs = [ "foo" ]
21 " }\n" 21 }
22 "}\n"); 22 })");
scottmg 2016/11/08 01:01:46 here
23 ASSERT_FALSE(input.has_error()); 23 ASSERT_FALSE(input.has_error());
24 24
25 Err err; 25 Err err;
26 input.parsed()->Execute(setup.scope(), &err); 26 input.parsed()->Execute(setup.scope(), &err);
27 ASSERT_FALSE(err.has_error()) << err.message(); 27 ASSERT_FALSE(err.has_error()) << err.message();
28 28
29 // It should have generated a toolchain. 29 // It should have generated a toolchain.
30 ASSERT_EQ(1u, setup.items().size()); 30 ASSERT_EQ(1u, setup.items().size());
31 const Toolchain* toolchain = setup.items()[0]->AsToolchain(); 31 const Toolchain* toolchain = setup.items()[0]->AsToolchain();
32 ASSERT_TRUE(toolchain); 32 ASSERT_TRUE(toolchain);
33 33
34 // The toolchain should have a link tool with the two outputs. 34 // The toolchain should have a link tool with the two outputs.
35 const Tool* link = toolchain->GetTool(Toolchain::TYPE_LINK); 35 const Tool* link = toolchain->GetTool(Toolchain::TYPE_LINK);
36 ASSERT_TRUE(link); 36 ASSERT_TRUE(link);
37 ASSERT_EQ(1u, link->outputs().list().size()); 37 ASSERT_EQ(1u, link->outputs().list().size());
38 EXPECT_EQ("foo", link->outputs().list()[0].AsString()); 38 EXPECT_EQ("foo", link->outputs().list()[0].AsString());
39 ASSERT_EQ(1u, link->runtime_outputs().list().size()); 39 ASSERT_EQ(1u, link->runtime_outputs().list().size());
40 EXPECT_EQ("foo", link->runtime_outputs().list()[0].AsString()); 40 EXPECT_EQ("foo", link->runtime_outputs().list()[0].AsString());
41 } 41 }
42 42
43 // This one is not a subset so should throw an error. 43 // This one is not a subset so should throw an error.
44 { 44 {
45 TestParseInput input( 45 TestParseInput input(
46 "toolchain(\"bad\") {\n" 46 R"(toolchain("bad") {
47 " tool(\"link\") {\n" 47 tool("link") {
48 " outputs = [ \"foo\" ]\n" 48 outputs = [ "foo" ]
49 " runtime_outputs = [ \"bar\" ]\n" 49 runtime_outputs = [ "bar" ]
50 " }\n" 50 }
51 "}\n"); 51 })");
scottmg 2016/11/08 01:01:46 here
52 ASSERT_FALSE(input.has_error()); 52 ASSERT_FALSE(input.has_error());
53 53
54 Err err; 54 Err err;
55 input.parsed()->Execute(setup.scope(), &err); 55 input.parsed()->Execute(setup.scope(), &err);
56 ASSERT_TRUE(err.has_error()) << err.message(); 56 ASSERT_TRUE(err.has_error()) << err.message();
57 } 57 }
58 } 58 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698