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

Unified Diff: base/json/json_writer_unittest.cc

Issue 9016024: Add option for not adding '.0' to the end of doubles that have no fractional (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 9 months 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') | chrome/test/webdriver/commands/response.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/json/json_writer_unittest.cc
diff --git a/base/json/json_writer_unittest.cc b/base/json/json_writer_unittest.cc
index 5d44c020efa5b59ce405dce26e98e484d60e18fc..6e73f945c43562ef22b42b810cf46e962cd1185d 100644
--- a/base/json/json_writer_unittest.cc
+++ b/base/json/json_writer_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -119,6 +119,14 @@ TEST(JSONWriterTest, Writing) {
JSONWriter::OPTIONS_OMIT_BINARY_VALUES,
&output_js);
ASSERT_EQ("{\"a\":5,\"c\":2}", output_js);
+
+ // Test allowing a double with no fractional part to be written as an integer.
+ FundamentalValue double_value(1e10);
+ JSONWriter::WriteWithOptions(
+ &double_value, false,
+ JSONWriter::OPTIONS_OMIT_DOUBLE_TYPE_PRESERVATION,
+ &output_js);
+ ASSERT_EQ("10000000000", output_js);
}
} // namespace base
« no previous file with comments | « base/json/json_writer.cc ('k') | chrome/test/webdriver/commands/response.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698