This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake".
The branch, next has been updated via 9a0a1ee098f0f1d78ee0b96e018e035da5549248 (commit) via 655c22a07d04ed1e5f9aff6d36b2e07834c835bc (commit) from 014cd12be616724899cb753884e3d808386b9941 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9a0a1ee098f0f1d78ee0b96e018e035da5549248 commit 9a0a1ee098f0f1d78ee0b96e018e035da5549248 Merge: 014cd12 655c22a Author: Joe Snyder <joe.sny...@kitware.com> AuthorDate: Tue Oct 28 10:23:11 2014 -0400 Commit: CMake Topic Stage <kwro...@kitware.com> CommitDate: Tue Oct 28 10:23:11 2014 -0400 Merge topic 'add_javascript_coverage_parser' into next 655c22a0 CTest: Fix spacing and remove unused variables http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=655c22a07d04ed1e5f9aff6d36b2e07834c835bc commit 655c22a07d04ed1e5f9aff6d36b2e07834c835bc Author: Joseph Snyder <joe.sny...@kitware.com> AuthorDate: Tue Oct 28 10:21:27 2014 -0400 Commit: Joseph Snyder <joe.sny...@kitware.com> CommitDate: Tue Oct 28 10:21:27 2014 -0400 CTest: Fix spacing and remove unused variables Fix the indentation in the BlanketJS file Remove the private cmCTest variable from the JSONCoverage class diff --git a/Source/CTest/cmParseBlanketJSCoverage.cxx b/Source/CTest/cmParseBlanketJSCoverage.cxx index b353cf0..5f4a708 100644 --- a/Source/CTest/cmParseBlanketJSCoverage.cxx +++ b/Source/CTest/cmParseBlanketJSCoverage.cxx @@ -21,119 +21,114 @@ class cmParseBlanketJSCoverage::JSONParser { - public: - typedef cmCTestCoverageHandlerContainer:: - SingleFileCoverageVector - FileLinesType; - JSONParser(cmCTest* ctest, cmCTestCoverageHandlerContainer& cont) - : CTest(ctest), Coverage(cont) +public: + typedef cmCTestCoverageHandlerContainer:: + SingleFileCoverageVector FileLinesType; + JSONParser(cmCTestCoverageHandlerContainer& cont) + : Coverage(cont) + { + } + + virtual ~JSONParser() + { + } + + std::string getValue(std::string line, int type) + { + size_t begIndex; + size_t endIndex; + endIndex = line.rfind(','); + begIndex = line.find_first_of(':'); + if(type == 0) { + // A unique substring to remove the extra characters + // around the files name in the JSON (extra " and ,) + std::string foundFileName = + line.substr(begIndex+3,endIndex-(begIndex+4)); + return foundFileName; } - - virtual ~JSONParser() + else { + return line.substr(begIndex,line.npos); } + } + bool ParseFile(std::string file) + { + FileLinesType localCoverageVector; + std::string filename; + bool foundFile = false; + bool inSource = false; + std::string covResult; + std::string line; - std::string getValue(std::string line, int type) + cmsys::ifstream in(file.c_str()); + if(!in) { - size_t begIndex; - size_t endIndex; - - endIndex = line.rfind(','); - begIndex = line.find_first_of(':'); - if(type == 0) - { - // A unique substring to remove the extra characters - // around the files name in the JSON (extra " and ,) - std::string foundFileName = - line.substr(begIndex+3,endIndex-(begIndex+4)); - return foundFileName; - } - else - { - return line.substr(begIndex,line.npos); - } + return false; } - bool ParseFile(std::string file) + while( cmSystemTools::GetLineFromStream(in, line)) { - FileLinesType localCoverageVector; - std::string filename; - bool foundFile = false; - bool inSource = false; - std::string covResult; - std::string line; - - cmsys::ifstream in(file.c_str()); - if(!in) - { - return false; - } - while( cmSystemTools::GetLineFromStream(in, line)) + if(line.find("filename") != line.npos) { - - if(line.find("filename") != line.npos) - { - if(foundFile) - { - /* - * Upon finding a second file name, generate a - * vector within the total coverage to capture the - * information in the local vector - */ - FileLinesType& CoverageVector = - this->Coverage.TotalCoverage[filename.c_str()]; - CoverageVector = localCoverageVector; - localCoverageVector.clear(); - foundFile=false; - } - foundFile= true; - inSource = false; - filename = getValue(line,0).c_str(); - } - else if((line.find("coverage") != line.npos) && foundFile && inSource ) + if(foundFile) { /* - * two types of "coverage" in the JSON structure - * - * The coverage result over the file or set of files - * and the coverage for each individual line - * - * FoundFile and foundSource ensure that - * only the value of the line coverage is captured + * Upon finding a second file name, generate a + * vector within the total coverage to capture the + * information in the local vector */ - std::string result = getValue(line,1).c_str(); - result = result.substr(2,result.npos); - - if(result == "\"\"") - { - // Empty quotation marks indicate that the - // line is not executable - localCoverageVector.push_back(-1); - } - else - { - // Else, it contains the number of time executed - localCoverageVector.push_back(atoi(result.c_str())); - } + FileLinesType& CoverageVector = + this->Coverage.TotalCoverage[filename.c_str()]; + CoverageVector = localCoverageVector; + localCoverageVector.clear(); + foundFile=false; } - else if(line.find("source") != line.npos) + foundFile= true; + inSource = false; + filename = getValue(line,0).c_str(); + } + else if((line.find("coverage") != line.npos) && foundFile && inSource ) + { + /* + * two types of "coverage" in the JSON structure + * + * The coverage result over the file or set of files + * and the coverage for each individual line + * + * FoundFile and foundSource ensure that + * only the value of the line coverage is captured + */ + std::string result = getValue(line,1).c_str(); + result = result.substr(2,result.npos); + if(result == "\"\"") { - inSource=true; + // Empty quotation marks indicate that the + // line is not executable + localCoverageVector.push_back(-1); + } + else + { + // Else, it contains the number of time executed + localCoverageVector.push_back(atoi(result.c_str())); } } - - // On exit, capture end of last file covered. - FileLinesType& CoverageVector = - this->Coverage.TotalCoverage[filename.c_str()]; - CoverageVector = localCoverageVector; - foundFile=false; - localCoverageVector.clear(); - return true; + else if(line.find("source") != line.npos) + { + inSource=true; + } } - private: - cmCTest* CTest; - cmCTestCoverageHandlerContainer& Coverage; - }; + + // On exit, capture end of last file covered. + FileLinesType& CoverageVector = + this->Coverage.TotalCoverage[filename.c_str()]; + CoverageVector = localCoverageVector; + foundFile=false; + localCoverageVector.clear(); + return true; + } +private: + cmCTestCoverageHandlerContainer& Coverage; +}; cmParseBlanketJSCoverage::cmParseBlanketJSCoverage( cmCTestCoverageHandlerContainer& cont, cmCTest* ctest) @@ -163,7 +158,7 @@ bool cmParseBlanketJSCoverage::LoadCoverageData(std::vector<std::string> files) bool cmParseBlanketJSCoverage::ReadJSONFile(std::string file) { cmParseBlanketJSCoverage::JSONParser parser - (this->CTest,this->Coverage); + (this->Coverage); cmCTestLog(this->CTest,HANDLER_VERBOSE_OUTPUT, "Parsing " << file << std::endl); parser.ParseFile(file); diff --git a/Source/CTest/cmParseBlanketJSCoverage.h b/Source/CTest/cmParseBlanketJSCoverage.h index a254263..fc1d477 100644 --- a/Source/CTest/cmParseBlanketJSCoverage.h +++ b/Source/CTest/cmParseBlanketJSCoverage.h @@ -31,18 +31,18 @@ * http://visionmedia.github.io/mocha/ */ class cmParseBlanketJSCoverage - { - public: - cmParseBlanketJSCoverage(cmCTestCoverageHandlerContainer& cont, - cmCTest* ctest); - bool LoadCoverageData(std::vector<std::string> files); - // Read the JSON output - bool ReadJSONFile(std::string file); - - protected: - - class JSONParser; - cmCTestCoverageHandlerContainer& Coverage; - cmCTest* CTest; - }; +{ +public: + cmParseBlanketJSCoverage(cmCTestCoverageHandlerContainer& cont, + cmCTest* ctest); + bool LoadCoverageData(std::vector<std::string> files); + // Read the JSON output + bool ReadJSONFile(std::string file); + +protected: + + class JSONParser; + cmCTestCoverageHandlerContainer& Coverage; + cmCTest* CTest; +}; #endif ----------------------------------------------------------------------- Summary of changes: Source/CTest/cmParseBlanketJSCoverage.cxx | 189 ++++++++++++++--------------- Source/CTest/cmParseBlanketJSCoverage.h | 28 ++--- 2 files changed, 106 insertions(+), 111 deletions(-) hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org http://public.kitware.com/mailman/listinfo/cmake-commits