MCPcopy Create free account
hub / github.com/cel-expr/cel-cpp / RegisterTestsFromFile

Function RegisterTestsFromFile

conformance/run.cc:221–251  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

219};
220
221absl::Status RegisterTestsFromFile(
222 const std::shared_ptr<cel_conformance::ConformanceServiceInterface>&
223 service,
224 absl::Span<const std::string> tests_to_skip, absl::string_view path) {
225 SimpleTestFile file;
226 {
227 std::ifstream in;
228 in.open(std::string(path), std::ios_base::in | std::ios_base::binary);
229 if (!in.is_open()) {
230 return absl::UnknownError(absl::StrCat("failed to open file: ", path));
231 }
232 google::protobuf::io::IstreamInputStream stream(&in);
233 if (!google::protobuf::TextFormat::Parse(&stream, &file)) {
234 return absl::UnknownError(absl::StrCat("failed to parse file: ", path));
235 }
236 }
237 for (const auto& section : file.section()) {
238 for (const auto& test : section.test()) {
239 const bool skip = ShouldSkipTest(
240 tests_to_skip,
241 absl::StrCat(file.name(), "/", section.name(), "/", test.name()));
242 testing::RegisterTest(
243 file.name().c_str(),
244 absl::StrCat(section.name(), "/", test.name()).c_str(), nullptr,
245 nullptr, __FILE__, __LINE__, [=]() -> ConformanceTest* {
246 return new ConformanceTest(service, test, skip);
247 });
248 }
249 }
250 return absl::OkStatus();
251}
252
253// We could push this do be done per test or suite, but to avoid changing more
254// than necessary we do it once to mimic the previous runner.

Callers 1

mainFunction · 0.85

Calls 2

ParseFunction · 0.50
nameMethod · 0.45

Tested by

no test coverage detected