OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/json/json_writer.h" |
| 6 #include "base/values.h" |
5 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
6 #include "base/json_writer.h" | 8 |
7 #include "base/values.h" | 9 namespace base { |
8 | 10 |
9 TEST(JSONWriterTest, Writing) { | 11 TEST(JSONWriterTest, Writing) { |
10 // Test null | 12 // Test null |
11 Value* root = Value::CreateNullValue(); | 13 Value* root = Value::CreateNullValue(); |
12 std::string output_js; | 14 std::string output_js; |
13 JSONWriter::Write(root, false, &output_js); | 15 JSONWriter::Write(root, false, &output_js); |
14 ASSERT_EQ("null", output_js); | 16 ASSERT_EQ("null", output_js); |
15 delete root; | 17 delete root; |
16 | 18 |
17 // Test empty dict | 19 // Test empty dict |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 #define JSON_NEWLINE "\n" | 70 #define JSON_NEWLINE "\n" |
69 #endif | 71 #endif |
70 ASSERT_EQ("{" JSON_NEWLINE | 72 ASSERT_EQ("{" JSON_NEWLINE |
71 " \"list\": [ {" JSON_NEWLINE | 73 " \"list\": [ {" JSON_NEWLINE |
72 " \"inner int\": 10" JSON_NEWLINE | 74 " \"inner int\": 10" JSON_NEWLINE |
73 " }, [ ], true ]" JSON_NEWLINE | 75 " }, [ ], true ]" JSON_NEWLINE |
74 "}" JSON_NEWLINE, | 76 "}" JSON_NEWLINE, |
75 output_js); | 77 output_js); |
76 #undef JSON_NEWLINE | 78 #undef JSON_NEWLINE |
77 } | 79 } |
| 80 |
| 81 } // namespace base |
OLD | NEW |