| 379 | } |
| 380 | |
| 381 | absl::StatusOr<CheckedExpr> TestRunner::GetCheckedExpr() const { |
| 382 | const CelExpressionSource* source_ptr = test_context_->expression_source(); |
| 383 | if (source_ptr == nullptr) { |
| 384 | return absl::InvalidArgumentError("No expression source provided."); |
| 385 | } |
| 386 | return std::visit( |
| 387 | absl::Overload([](const cel::expr::CheckedExpr& v) |
| 388 | -> absl::StatusOr<CheckedExpr> { return v; }, |
| 389 | [this](const CelExpressionSource::RawExpression& v) |
| 390 | -> absl::StatusOr<CheckedExpr> { |
| 391 | return Compile(v.value, *test_context_); |
| 392 | }, |
| 393 | [this](const CelExpressionSource::CelFile& v) |
| 394 | -> absl::StatusOr<CheckedExpr> { |
| 395 | CEL_ASSIGN_OR_RETURN(std::string contents, |
| 396 | ReadFileToString(v.path)); |
| 397 | return Compile(contents, *test_context_); |
| 398 | }), |
| 399 | source_ptr->source()); |
| 400 | } |
| 401 | |
| 402 | absl::Status TestRunner::EnableCoverage() { |
| 403 | if (test_context_ != nullptr && test_context_->enable_coverage()) { |
no test coverage detected