summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/GoogleTest/xml_output.cpp
diff options
context:
space:
mode:
authorStefan Floeren <stefan.floeren@smartronic.de>2020-06-30 09:29:53 (GMT)
committerBrad King <brad.king@kitware.com>2020-07-01 10:48:19 (GMT)
commit7b92e116830805e61a86119071e56b47eb5dd51c (patch)
tree7b9d258ae07b7a179bc94c1a6d563fb6f42341a7 /Tests/RunCMake/GoogleTest/xml_output.cpp
parent77ba7539adb805b154b778046eda491b40acf09e (diff)
downloadCMake-7b92e116830805e61a86119071e56b47eb5dd51c.zip
CMake-7b92e116830805e61a86119071e56b47eb5dd51c.tar.gz
CMake-7b92e116830805e61a86119071e56b47eb5dd51c.tar.bz2
Tests: Add test for GoogleTest XML_OUTPUT_DIR
Add tests to make sure the XML_OUTPUT_DIR is generated correctly and the correct files are getting created.
Diffstat (limited to 'Tests/RunCMake/GoogleTest/xml_output.cpp')
-rw-r--r--Tests/RunCMake/GoogleTest/xml_output.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/Tests/RunCMake/GoogleTest/xml_output.cpp b/Tests/RunCMake/GoogleTest/xml_output.cpp
index e130231..82f0d02 100644
--- a/Tests/RunCMake/GoogleTest/xml_output.cpp
+++ b/Tests/RunCMake/GoogleTest/xml_output.cpp
@@ -13,11 +13,22 @@ int main(int argc, char** argv)
// This actually defines the name of the file passed in the 2nd run
std::cout << "GoogleTestXML." << std::endl;
std::cout << " Foo" << std::endl;
+ // When changing these names, make sure to adapt the folder creation
+ // in GoogleTestXML.cmake
+ std::cout << "GoogleTestXMLSpecial/cases." << std::endl;
+ std::cout << " case/0 # GetParam() = 42" << std::endl;
+ std::cout << " case/1 # GetParam() = \"string\"" << std::endl;
+ std::cout << " case/2 # GetParam() = \"path/like\"" << std::endl;
} else if (param.find("--gtest_output=xml:") != std::string::npos) {
std::string::size_type split = param.find(":");
std::string filepath = param.substr(split + 1);
// The full file path is passed
std::ofstream ostrm(filepath.c_str(), std::ios::binary);
+ if (!ostrm) {
+ std::cerr << "Failed to create file: " << filepath.c_str()
+ << std::endl;
+ return 1;
+ }
ostrm << "--gtest_output=xml: mockup file\n";
}
}