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:
Cory Quammen
2014-10-09 16:29:47 -04:00
parent aa650c5b9d
commit 4d23492d11
21 changed files with 49 additions and 0 deletions

View File

@@ -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,