| Index: tools/gn/value_unittest.cc
|
| diff --git a/tools/gn/value_unittest.cc b/tools/gn/value_unittest.cc
|
| index c7d49488d884798e476888b5a891897977d61d18..3fa990d4a28e915190c927f4fd36153f0a8c9b02 100644
|
| --- a/tools/gn/value_unittest.cc
|
| +++ b/tools/gn/value_unittest.cc
|
| @@ -3,6 +3,7 @@
|
| // found in the LICENSE file.
|
|
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| +#include "tools/gn/test_with_scope.h"
|
| #include "tools/gn/value.h"
|
|
|
| TEST(Value, ToString) {
|
| @@ -10,6 +11,9 @@ TEST(Value, ToString) {
|
| EXPECT_EQ("hi\" $me\\you\\$\\\"", strval.ToString(false));
|
| EXPECT_EQ("\"hi\\\" \\$me\\you\\\\\\$\\\\\\\"\"", strval.ToString(true));
|
|
|
| + // Void type.
|
| + EXPECT_EQ("<void>", Value().ToString(false));
|
| +
|
| // Test lists, bools, and ints.
|
| Value listval(NULL, Value::LIST);
|
| listval.list_value().push_back(Value(NULL, "hi\"me"));
|
| @@ -21,9 +25,14 @@ TEST(Value, ToString) {
|
| EXPECT_EQ("[\"hi\\\"me\", true, false, 42]", listval.ToString(false));
|
| EXPECT_EQ("[\"hi\\\"me\", true, false, 42]", listval.ToString(true));
|
|
|
| - // Some weird types, we may want to enhance or change printing of these, but
|
| - // here we test the current behavior.
|
| - EXPECT_EQ("<void>", Value().ToString(false));
|
| - EXPECT_EQ("<scope>", Value(NULL, Value::SCOPE).ToString(false));
|
| + // Scopes.
|
| + TestWithScope setup;
|
| + Scope* scope = new Scope(setup.scope());
|
| + Value scopeval(NULL, scoped_ptr<Scope>(scope));
|
| + EXPECT_EQ("{ }", scopeval.ToString(false));
|
| +
|
| + scope->SetValue("a", Value(NULL, static_cast<int64>(42)), NULL);
|
| + scope->SetValue("b", Value(NULL, "hello, world"), NULL);
|
| + EXPECT_EQ("{\n a = 42\n b = \"hello, world\"\n}", scopeval.ToString(false));
|
| }
|
|
|
|
|