mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-10-14 23:07:55 +02:00
Added printing of comments to *.actual test files
This enables testing of comment-handling code. Updated *.expected test result files to account for printing of comments.
This commit is contained in:
@@ -61,6 +61,9 @@ static std::string readInputTestFile(const char* path) {
|
||||
|
||||
static void
|
||||
printValueTree(FILE* fout, Json::Value& value, const std::string& path = ".") {
|
||||
if (value.hasComment(Json::commentBefore)) {
|
||||
fprintf(fout, "%s\n", value.getComment(Json::commentBefore).c_str());
|
||||
}
|
||||
switch (value.type()) {
|
||||
case Json::nullValue:
|
||||
fprintf(fout, "%s=null\n", path.c_str());
|
||||
@@ -117,6 +120,10 @@ printValueTree(FILE* fout, Json::Value& value, const std::string& path = ".") {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (value.hasComment(Json::commentAfter)) {
|
||||
fprintf(fout, "%s\n", value.getComment(Json::commentAfter).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
static int parseAndSaveValueTree(const std::string& input,
|
||||
|
Reference in New Issue
Block a user