| Index: tools/gn/operators_unittest.cc
|
| diff --git a/tools/gn/operators_unittest.cc b/tools/gn/operators_unittest.cc
|
| index 16d626f0b33effb1f752437dc9f2c39359ef3666..7d59640cc581ad9a4869e6530a9821e02b67b8c1 100644
|
| --- a/tools/gn/operators_unittest.cc
|
| +++ b/tools/gn/operators_unittest.cc
|
| @@ -22,6 +22,15 @@ bool IsValueStringEqualing(const Value& v, const char* s) {
|
| return v.string_value() == s;
|
| }
|
|
|
| +// Returns a list populated with a single literal Value corresponding to the
|
| +// given token. The token must outlive the list (since the list will just
|
| +// copy the reference).
|
| +scoped_ptr<ListNode> ListWithLiteral(const Token& token) {
|
| + scoped_ptr<ListNode> list(new ListNode);
|
| + list->append_item(scoped_ptr<ParseNode>(new LiteralNode(token)));
|
| + return list.Pass();
|
| +}
|
| +
|
| } // namespace
|
|
|
| TEST(Operators, SourcesAppend) {
|
| @@ -50,21 +59,21 @@ TEST(Operators, SourcesAppend) {
|
| // Append an integer.
|
| const char integer_value[] = "5";
|
| Token integer(Location(), Token::INTEGER, integer_value);
|
| - node.set_right(scoped_ptr<ParseNode>(new LiteralNode(integer)));
|
| + node.set_right(ListWithLiteral(integer).PassAs<ParseNode>());
|
| node.Execute(setup.scope(), &err);
|
| EXPECT_FALSE(err.has_error());
|
|
|
| // Append a string that doesn't match the pattern, it should get appended.
|
| const char string_1_value[] = "\"good\"";
|
| Token string_1(Location(), Token::STRING, string_1_value);
|
| - node.set_right(scoped_ptr<ParseNode>(new LiteralNode(string_1)));
|
| + node.set_right(ListWithLiteral(string_1).PassAs<ParseNode>());
|
| node.Execute(setup.scope(), &err);
|
| EXPECT_FALSE(err.has_error());
|
|
|
| // Append a string that does match the pattern, it should be a no-op.
|
| const char string_2_value[] = "\"foo-rm\"";
|
| Token string_2(Location(), Token::STRING, string_2_value);
|
| - node.set_right(scoped_ptr<ParseNode>(new LiteralNode(string_2)));
|
| + node.set_right(ListWithLiteral(string_2).PassAs<ParseNode>());
|
| node.Execute(setup.scope(), &err);
|
| EXPECT_FALSE(err.has_error());
|
|
|
|
|