MCPcopy Create free account
hub / github.com/cginternals/globjects / LoadFlagsFromFile

Function LoadFlagsFromFile

source/tests/googletest/googletest/src/gtest.cc:5251–5270  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5249
5250#if GTEST_USE_OWN_FLAGFILE_FLAG_
5251void LoadFlagsFromFile(const std::string& path) {
5252 FILE* flagfile = posix::FOpen(path.c_str(), "r");
5253 if (!flagfile) {
5254 fprintf(stderr,
5255 "Unable to open file \"%s\"\n",
5256 GTEST_FLAG(flagfile).c_str());
5257 fflush(stderr);
5258 exit(EXIT_FAILURE);
5259 }
5260 std::string contents(ReadEntireFile(flagfile));
5261 posix::FClose(flagfile);
5262 std::vector<std::string> lines;
5263 SplitString(contents, '\n', &lines);
5264 for (size_t i = 0; i < lines.size(); ++i) {
5265 if (lines[i].empty())
5266 continue;
5267 if (!ParseGoogleTestFlag(lines[i].c_str()))
5268 g_help_flag = true;
5269 }
5270}
5271#endif // GTEST_USE_OWN_FLAGFILE_FLAG_
5272
5273// Parses the command line for Google Test flags, without initializing

Callers 1

Calls 6

FOpenFunction · 0.85
ReadEntireFileFunction · 0.85
FCloseFunction · 0.85
SplitStringFunction · 0.85
ParseGoogleTestFlagFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected