You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2014/02/19 21:37:14 UTC

git commit: Change stout JSON::Value default to be JSON::Null.

Repository: mesos
Updated Branches:
  refs/heads/master db3b5ed86 -> 9968b66f5


Change stout JSON::Value default to be JSON::Null.

The first type specified for the variant which is JSON::Value is the
default. Currently that is JSON::String which in turn defaults to
empty string. JSON::Null would be a more correct default value.

This change moves JSON::Null to the front of the declaration so that
it becomes the default and adds a unit test.

Review: https://reviews.apache.org/r/17568


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/9968b66f
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/9968b66f
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/9968b66f

Branch: refs/heads/master
Commit: 9968b66f5922d186fbf294cf4d7df7e0c9f444dd
Parents: db3b5ed
Author: Charlie Carson <ch...@gmail.com>
Authored: Wed Feb 19 12:36:20 2014 -0800
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Wed Feb 19 12:36:20 2014 -0800

----------------------------------------------------------------------
 3rdparty/libprocess/3rdparty/stout/include/stout/json.hpp | 7 ++++---
 3rdparty/libprocess/3rdparty/stout/tests/json_tests.cpp   | 7 +++++++
 2 files changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/9968b66f/3rdparty/libprocess/3rdparty/stout/include/stout/json.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/json.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/json.hpp
index 3148a78..8b64e89 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/json.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/json.hpp
@@ -52,13 +52,14 @@ struct False;
 struct Null;
 
 
-typedef boost::variant<boost::recursive_wrapper<String>,
+// Null needs to be first so that it is the default value.
+typedef boost::variant<boost::recursive_wrapper<Null>,
+                       boost::recursive_wrapper<String>,
                        boost::recursive_wrapper<Number>,
                        boost::recursive_wrapper<Object>,
                        boost::recursive_wrapper<Array>,
                        boost::recursive_wrapper<True>,
-                       boost::recursive_wrapper<False>,
-                       boost::recursive_wrapper<Null> > Value;
+                       boost::recursive_wrapper<False> > Value;
 
 
 struct String

http://git-wip-us.apache.org/repos/asf/mesos/blob/9968b66f/3rdparty/libprocess/3rdparty/stout/tests/json_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/tests/json_tests.cpp b/3rdparty/libprocess/3rdparty/stout/tests/json_tests.cpp
index 29ada8a..aafaaa6 100644
--- a/3rdparty/libprocess/3rdparty/stout/tests/json_tests.cpp
+++ b/3rdparty/libprocess/3rdparty/stout/tests/json_tests.cpp
@@ -10,6 +10,13 @@
 using std::string;
 
 
+TEST(JsonTest, DefaultValueIsNull)
+{
+  JSON::Value v;
+  EXPECT_EQ("null", stringify(v));
+}
+
+
 TEST(JsonTest, BinaryData)
 {
   JSON::String s(string("\"\\/\b\f\n\r\t\x00\x19 !#[]\x7F\xFF", 17));