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

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

Issue 1869503004: Convert //tools to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, change iwyu fixes for converted directories to include <memory> Created 4 years, 8 months 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
« no previous file with comments | « tools/gn/value.cc ('k') | tools/gn/visual_studio_writer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "tools/gn/test_with_scope.h" 8 #include "tools/gn/test_with_scope.h"
9 #include "tools/gn/value.h" 9 #include "tools/gn/value.h"
10 10
(...skipping 16 matching lines...) Expand all
27 listval.list_value().push_back(Value(nullptr, false)); 27 listval.list_value().push_back(Value(nullptr, false));
28 listval.list_value().push_back(Value(nullptr, static_cast<int64_t>(42))); 28 listval.list_value().push_back(Value(nullptr, static_cast<int64_t>(42)));
29 // Printing lists always causes embedded strings to be quoted (ignoring the 29 // Printing lists always causes embedded strings to be quoted (ignoring the
30 // quote flag), or else they wouldn't make much sense. 30 // quote flag), or else they wouldn't make much sense.
31 EXPECT_EQ("[\"hi\\\"me\", true, false, 42]", listval.ToString(false)); 31 EXPECT_EQ("[\"hi\\\"me\", true, false, 42]", listval.ToString(false));
32 EXPECT_EQ("[\"hi\\\"me\", true, false, 42]", listval.ToString(true)); 32 EXPECT_EQ("[\"hi\\\"me\", true, false, 42]", listval.ToString(true));
33 33
34 // Scopes. 34 // Scopes.
35 TestWithScope setup; 35 TestWithScope setup;
36 Scope* scope = new Scope(setup.scope()); 36 Scope* scope = new Scope(setup.scope());
37 Value scopeval(nullptr, scoped_ptr<Scope>(scope)); 37 Value scopeval(nullptr, std::unique_ptr<Scope>(scope));
38 EXPECT_EQ("{ }", scopeval.ToString(false)); 38 EXPECT_EQ("{ }", scopeval.ToString(false));
39 39
40 scope->SetValue("a", Value(nullptr, static_cast<int64_t>(42)), nullptr); 40 scope->SetValue("a", Value(nullptr, static_cast<int64_t>(42)), nullptr);
41 scope->SetValue("b", Value(nullptr, "hello, world"), nullptr); 41 scope->SetValue("b", Value(nullptr, "hello, world"), nullptr);
42 EXPECT_EQ("{\n a = 42\n b = \"hello, world\"\n}", scopeval.ToString(false)); 42 EXPECT_EQ("{\n a = 42\n b = \"hello, world\"\n}", scopeval.ToString(false));
43 } 43 }
OLDNEW
« no previous file with comments | « tools/gn/value.cc ('k') | tools/gn/visual_studio_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698