+TEST(Json, ParseTrailingComma) {
+ folly::json::serialization_opts on, off;
+ on.allow_trailing_comma = true;
+ off.allow_trailing_comma = false;
+
+ dynamic arr = dynamic::array(1, 2);
+ EXPECT_EQ(arr, parseJson("[1, 2]", on));
+ EXPECT_EQ(arr, parseJson("[1, 2,]", on));
+ EXPECT_EQ(arr, parseJson("[1, 2, ]", on));
+ EXPECT_EQ(arr, parseJson("[1, 2 , ]", on));
+ EXPECT_EQ(arr, parseJson("[1, 2 ,]", on));
+ EXPECT_THROW(parseJson("[1, 2,]", off), std::runtime_error);
+
+ dynamic obj = dynamic::object("a", 1);
+ EXPECT_EQ(obj, parseJson("{\"a\": 1}", on));
+ EXPECT_EQ(obj, parseJson("{\"a\": 1,}", on));
+ EXPECT_EQ(obj, parseJson("{\"a\": 1, }", on));
+ EXPECT_EQ(obj, parseJson("{\"a\": 1 , }", on));
+ EXPECT_EQ(obj, parseJson("{\"a\": 1 ,}", on));
+ EXPECT_THROW(parseJson("{\"a\":1,}", off), std::runtime_error);
+}
+
+TEST(Json, BoolConversion) {
+ EXPECT_TRUE(parseJson("42").asBool());
+}
+