BIND 10 trac1626, updated. 9ee14145b2879b044fdf0c32678838ee67343094 [1626] move some more json tests around

BIND 10 source code commits bind10-changes at lists.isc.org
Mon Apr 2 13:36:19 UTC 2012


The branch, trac1626 has been updated
       via  9ee14145b2879b044fdf0c32678838ee67343094 (commit)
      from  6e57b76919731d8f5a15d21d2c008336362f44c9 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 9ee14145b2879b044fdf0c32678838ee67343094
Author: Jelte Jansen <jelte at isc.org>
Date:   Mon Apr 2 15:36:04 2012 +0200

    [1626] move some more json tests around

-----------------------------------------------------------------------

Summary of changes:
 src/lib/cc/tests/data_unittests.cc |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/cc/tests/data_unittests.cc b/src/lib/cc/tests/data_unittests.cc
index 802ba8c..87d92f6 100644
--- a/src/lib/cc/tests/data_unittests.cc
+++ b/src/lib/cc/tests/data_unittests.cc
@@ -91,7 +91,7 @@ TEST(Element, from_and_to_json) {
     sv.push_back("-1");
     sv.push_back("-1.234");
     sv.push_back("-123.456");
-    
+
     BOOST_FOREACH(const std::string& s, sv) {
         // test << operator, which uses Element::str()
         std::ostringstream stream;
@@ -127,8 +127,12 @@ TEST(Element, from_and_to_json) {
     sv.push_back("\"foobar\"hello");
     sv.push_back("[]hello");
     sv.push_back("{}hello");
+    // String not delimited correctly
+    sv.push_back("\"hello");
+    sv.push_back("hello\"");
+
+
     BOOST_FOREACH(std::string s, sv) {
-        
         EXPECT_THROW(el = Element::fromJSON(s), isc::data::JSONError);
     }
 
@@ -155,6 +159,9 @@ TEST(Element, from_and_to_json) {
     EXPECT_EQ("false", Element::fromJSON("FALSE")->str());
     EXPECT_EQ("true", Element::fromJSON("True")->str());
     EXPECT_EQ("true", Element::fromJSON("TRUE")->str());
+    EXPECT_EQ("\"\"", Element::fromJSON("  \n \t \r \f \b \"\" \n \f \t \r \b")->str());
+    EXPECT_EQ("{  }", Element::fromJSON("{  \n  \r \t  \b \f }")->str());
+    EXPECT_EQ("[  ]", Element::fromJSON("[  \n  \r \f \t  \b  ]")->str());
 
     // number overflows
     EXPECT_THROW(Element::fromJSON("12345678901234567890")->str(), JSONError);
@@ -337,15 +344,8 @@ TEST(Element, escape) {
     EXPECT_THROW(Element::fromJSON("\\\"\\\""), JSONError);
     // Inside strings is OK
     EXPECT_NO_THROW(Element::fromJSON("\"\\\"\\\"\""));
-    // String not delimited correctly
-    EXPECT_THROW(Element::fromJSON("\"hello"), JSONError);
-    EXPECT_THROW(Element::fromJSON("hello\""), JSONError);
     // A whitespace test
     EXPECT_NO_THROW(Element::fromJSON("\"  \n  \r \t \f  \n \n    \t\""));
-    // Whitespace outside of json element
-    EXPECT_NO_THROW(Element::fromJSON("  \n \t \r \f \b \"\" \n \f \t \r \b"));
-    EXPECT_NO_THROW(Element::fromJSON("{  \n  \r \t  \b \f }"));
-    EXPECT_NO_THROW(Element::fromJSON("[  \n  \r \f \t  \b  ]"));
 }
 
 TEST(Element, ListElement) {



More information about the bind10-changes mailing list