Skip to content

Commit acf3b5d

Browse files
authored
Add test for allowDroppedNullPlaceholders (#1648)
1 parent 728ad03 commit acf3b5d

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/test_lib_json/main.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3095,6 +3095,17 @@ JSONTEST_FIXTURE_LOCAL(ReaderTest, allowNumericKeysTest) {
30953095
checkParse(R"({ 123 : "abc" })");
30963096
}
30973097

3098+
JSONTEST_FIXTURE_LOCAL(ReaderTest, allowDroppedNullPlaceholders) {
3099+
Json::Features features;
3100+
features.allowDroppedNullPlaceholders_ = true;
3101+
setFeatures(features);
3102+
checkParse(R"([1,,2])");
3103+
JSONTEST_ASSERT_EQUAL(3, root.size());
3104+
JSONTEST_ASSERT_EQUAL(1, root[0].asInt());
3105+
JSONTEST_ASSERT(root[1].isNull());
3106+
JSONTEST_ASSERT_EQUAL(2, root[2].asInt());
3107+
}
3108+
30983109
struct CharReaderTest : JsonTest::TestCase {};
30993110

31003111
JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseWithNoErrors) {

0 commit comments

Comments
 (0)