Commit 2924aaa7 by Dominic Hamon

Deal with names with embedded quotes

parent b6e4f67d
......@@ -73,8 +73,12 @@ void CSVReporter::PrintRunData(Run const& run) {
cpu_time = cpu_time / static_cast<double>(run.iterations);
}
// Field with embedded commas must be delimited with double-quotes.
std::cout << "\"" << run.benchmark_name << "\",";
// Field with embedded double-quote characters must be doubled and the field
// delimited with double-quotes.
std::string name = run.benchmark_name;
ReplaceAll(&name, "\"", "\"\"");
std::cout << "\"" << name << "\",";
std::cout << run.iterations << ",";
std::cout << real_time << ",";
std::cout << cpu_time << ",";
......@@ -92,7 +96,6 @@ void CSVReporter::PrintRunData(Run const& run) {
// delimited with double-quotes.
std::string label = run.report_label;
ReplaceAll(&label, "\"", "\"\"");
std::cout << "\"" << label << "\"";
}
std::cout << '\n';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment