| Index: base/json/json_writer_unittest.cc
|
| ===================================================================
|
| --- base/json/json_writer_unittest.cc (revision 32858)
|
| +++ base/json/json_writer_unittest.cc (working copy)
|
| @@ -1,4 +1,4 @@
|
| -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
|
| +// Copyright (c) 2009 The Chromium Authors. All rights reserved.
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| @@ -76,6 +76,23 @@
|
| "}" JSON_NEWLINE,
|
| output_js);
|
| #undef JSON_NEWLINE
|
| +
|
| + // Test keys with periods
|
| + DictionaryValue period_dict;
|
| + period_dict.SetWithoutPathExpansion(L"a.b", Value::CreateIntegerValue(3));
|
| + period_dict.SetWithoutPathExpansion(L"c", Value::CreateIntegerValue(2));
|
| + DictionaryValue* period_dict2 = new DictionaryValue;
|
| + period_dict2->SetWithoutPathExpansion(L"g.h.i.j",
|
| + Value::CreateIntegerValue(1));
|
| + period_dict.SetWithoutPathExpansion(L"d.e.f", period_dict2);
|
| + JSONWriter::Write(&period_dict, false, &output_js);
|
| + ASSERT_EQ("{\"a.b\":3,\"c\":2,\"d.e.f\":{\"g.h.i.j\":1}}", output_js);
|
| +
|
| + DictionaryValue period_dict3;
|
| + period_dict3.Set(L"a.b", Value::CreateIntegerValue(2));
|
| + period_dict3.SetWithoutPathExpansion(L"a.b", Value::CreateIntegerValue(1));
|
| + JSONWriter::Write(&period_dict3, false, &output_js);
|
| + ASSERT_EQ("{\"a\":{\"b\":2},\"a.b\":1}", output_js);
|
| }
|
|
|
| } // namespace base
|
|
|