diff options
author | Kitware Robot <kwrobot@kitware.com> | 2016-05-16 14:34:04 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-05-16 20:05:19 (GMT) |
commit | d9fd2f5402eeaa345691313658e02b51038f570b (patch) | |
tree | dca71b9a7e267f4c6300da3eb770415381726785 /Tests/CMakeLib/testRST.cxx | |
parent | 82df6deaafb36cbbfd450202bb20b320f637751a (diff) | |
download | CMake-d9fd2f5402eeaa345691313658e02b51038f570b.zip CMake-d9fd2f5402eeaa345691313658e02b51038f570b.tar.gz CMake-d9fd2f5402eeaa345691313658e02b51038f570b.tar.bz2 |
Revise C++ coding style using clang-format
Run the `Utilities/Scripts/clang-format.bash` script to update
all our C++ code to a new style defined by `.clang-format`.
Use `clang-format` version 3.8.
* If you reached this commit for a line in `git blame`, re-run the blame
operation starting at the parent of this commit to see older history
for the content.
* See the parent commit for instructions to rebase a change across this
style transition commit.
Diffstat (limited to 'Tests/CMakeLib/testRST.cxx')
-rw-r--r-- | Tests/CMakeLib/testRST.cxx | 64 |
1 files changed, 27 insertions, 37 deletions
diff --git a/Tests/CMakeLib/testRST.cxx b/Tests/CMakeLib/testRST.cxx index 37cb3fa..a575d0d 100644 --- a/Tests/CMakeLib/testRST.cxx +++ b/Tests/CMakeLib/testRST.cxx @@ -15,67 +15,57 @@ void reportLine(std::ostream& os, bool ret, std::string line, bool eol) { - if(ret) - { - os << "\"" << line << "\" (" << (eol?"with EOL":"without EOL") << ")"; - } - else - { + if (ret) { + os << "\"" << line << "\" (" << (eol ? "with EOL" : "without EOL") << ")"; + } else { os << "EOF"; - } + } } int testRST(int argc, char* argv[]) { - if(argc != 2) - { + if (argc != 2) { std::cerr << "Usage: testRST <dir>" << std::endl; return 1; - } + } std::string dir = argv[1]; - if(dir.empty()) - { + if (dir.empty()) { dir = "."; - } + } std::string a_name = "testRST.actual"; std::string e_name = dir + "/testRST.expect"; // Process the test RST file. { - std::string fname = dir + "/testRST.rst"; - std::ofstream fout(a_name.c_str()); - if(!fout) - { - std::cerr << "Could not open output " << a_name << std::endl; - return 1; + std::string fname = dir + "/testRST.rst"; + std::ofstream fout(a_name.c_str()); + if (!fout) { + std::cerr << "Could not open output " << a_name << std::endl; + return 1; } - cmRST r(fout, dir); - if(!r.ProcessFile(fname)) - { - std::cerr << "Could not open input " << fname << std::endl; - return 1; + cmRST r(fout, dir); + if (!r.ProcessFile(fname)) { + std::cerr << "Could not open input " << fname << std::endl; + return 1; } } // Compare expected and actual outputs. std::ifstream e_fin(e_name.c_str()); std::ifstream a_fin(a_name.c_str()); - if(!e_fin) - { + if (!e_fin) { std::cerr << "Could not open input " << e_name << std::endl; return 1; - } - if(!a_fin) - { + } + if (!a_fin) { std::cerr << "Could not open input " << a_name << std::endl; return 1; - } + } int lineno = 0; bool e_ret; bool a_ret; - do - { + do { std::string e_line; std::string a_line; bool e_eol; @@ -83,11 +73,11 @@ int testRST(int argc, char* argv[]) e_ret = cmSystemTools::GetLineFromStream(e_fin, e_line, &e_eol); a_ret = cmSystemTools::GetLineFromStream(a_fin, a_line, &a_eol); ++lineno; - if(e_ret != a_ret || e_line != a_line || e_eol != a_eol) - { + if (e_ret != a_ret || e_line != a_line || e_eol != a_eol) { a_fin.seekg(0, std::ios::beg); std::cerr << "Actual output does not match that expected on line " - << lineno << "." << std::endl << "Expected "; + << lineno << "." << std::endl + << "Expected "; reportLine(std::cerr, e_ret, e_line, e_eol); std::cerr << " but got "; reportLine(std::cerr, a_ret, a_line, a_eol); @@ -95,7 +85,7 @@ int testRST(int argc, char* argv[]) << "Actual output:" << std::endl << a_fin.rdbuf(); return 1; - } - } while(e_ret && a_ret); + } + } while (e_ret && a_ret); return 0; } |