add testing for comment functionality
parent
08c391f89a
commit
de098c4d52
22
test.cpp
22
test.cpp
|
@ -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 };
|
||||
|
|
Loading…
Reference in New Issue