add testing for comment functionality

mutable-v2
Antonio Cervone 2015-11-27 16:46:18 +01:00
parent 08c391f89a
commit de098c4d52
1 changed files with 22 additions and 0 deletions

View File

@ -58,6 +58,28 @@ int main(int argc, char **argv) {
std::cout << " - " << k.dump() << "\n";
}
#ifdef JSON11_COMMENTS
const string comment_test = R"({
// comment
"a": 1,
// comment
// continued
"b": "text",
/* multi
line
comment */
"c": [1, 2, 3]
})";
string err_comment;
auto json_comment = Json::parse(comment_test, err_comment);
if (!err_comment.empty()) {
printf("Failed: %s\n", err_comment.c_str());
} else {
printf("Result: %s\n", json_comment.dump().c_str());
}
#endif
std::list<int> l1 { 1, 2, 3 };
std::vector<int> l2 { 1, 2, 3 };
std::set<int> l3 { 1, 2, 3 };