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 <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 Loading... |
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 } |
OLD | NEW |