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

Unified Diff: base/json/json_writer_unittest.cc

Issue 441008: Many changes to DictionaryValues:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/json/json_writer.cc ('k') | base/values.h » ('j') | base/values.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « base/json/json_writer.cc ('k') | base/values.h » ('j') | base/values.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698