MCPcopy Create free account
hub / github.com/OpenCppCoverage/OpenCppCoverage / Parse

Function Parse

CppCoverageTest/OptionsParserUnifiedDiffTest.cpp:34–57  ·  view source on GitHub ↗

-------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

32 {
33 //-------------------------------------------------------------------------
34 boost::optional<cov::Options> Parse(
35 const std::vector<cov::UnifiedDiffSettings>& unifiedDiffSettingsCollection)
36 {
37 cov::OptionsParser parser;
38 std::wostringstream ostr;
39 std::vector<std::string> arguments;
40
41 for (const auto& unifiedDiffSettings : unifiedDiffSettingsCollection)
42 {
43 arguments.push_back(TestTools::GetOptionPrefix() + cov::ProgramOptions::UnifiedDiffOption);
44
45 auto value = unifiedDiffSettings.GetUnifiedDiffPath().string();
46 auto rootDiffFolder = unifiedDiffSettings.GetRootDiffFolder();
47 if (rootDiffFolder)
48 value += cov::OptionsParser::PathSeparator + rootDiffFolder->string();
49 arguments.push_back(value);
50 }
51
52 auto option = TestTools::Parse(parser, arguments, true, &ostr);
53
54 if (!option && ostr.str().empty())
55 throw std::runtime_error("Expect error message.");
56 return option;
57 }
58
59
60 //-------------------------------------------------------------------------

Callers 2

CheckUnifiedDiffSettingsFunction · 0.70
TEST_FFunction · 0.70

Calls 2

GetOptionPrefixFunction · 0.85
ToVectorFunction · 0.85

Tested by

no test coverage detected