From a29f99f27df0d39ad097b393dff0ef12f6e89388 Mon Sep 17 00:00:00 2001 From: Mukund Sivaraman Date: Mon, 2 Apr 2012 17:23:09 +0530 Subject: [PATCH] [1626] Add more testcases --- src/lib/cc/tests/data_unittests.cc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/lib/cc/tests/data_unittests.cc b/src/lib/cc/tests/data_unittests.cc index c7320260be..84ee33e6be 100644 --- a/src/lib/cc/tests/data_unittests.cc +++ b/src/lib/cc/tests/data_unittests.cc @@ -333,16 +333,18 @@ TEST(Element, escape) { EXPECT_THROW(Element::fromJSON("\\\"\\\""), JSONError); // Inside strings is OK EXPECT_NO_THROW(Element::fromJSON("\"\\\"\\\"\"")); - // String not terminated + // String not delimited correctly EXPECT_THROW(Element::fromJSON("\"hello"), JSONError); - // Bad string + EXPECT_THROW(Element::fromJSON("hello\""), JSONError); + // Bad strings EXPECT_THROW(Element::fromJSON("hello\"foobar\""), JSONError); + EXPECT_THROW(Element::fromJSON("\"foobar\"hello"), JSONError); // A whitespace test - EXPECT_NO_THROW(Element::fromJSON("\" \n \r \t \n \n \t\"")); + 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 \b \"\" \n \t \r \b")); - EXPECT_NO_THROW(Element::fromJSON("{ \n \r \t \b }")); - EXPECT_NO_THROW(Element::fromJSON("[ \n \r \t \b ]")); + 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) {