| 69 | class TestLibrary : public CompilerLibrary { |
| 70 | public: |
| 71 | explicit TestLibrary(int version) |
| 72 | : CompilerLibrary( |
| 73 | "testlib", |
| 74 | [version](ParserBuilder& builder) { |
| 75 | absl::Status status; |
| 76 | CEL_ASSIGN_OR_RETURN( |
| 77 | auto macro1, |
| 78 | cel::Macro::Global("testMacro1", 0, TestMacroExpander)); |
| 79 | status.Update(builder.AddMacro(macro1)); |
| 80 | if (version == 2) { |
| 81 | CEL_ASSIGN_OR_RETURN( |
| 82 | auto macro2, |
| 83 | cel::Macro::Global("testMacro2", 0, TestMacroExpander)); |
| 84 | status.Update(builder.AddMacro(macro2)); |
| 85 | } |
| 86 | return status; |
| 87 | }, |
| 88 | [version](TypeCheckerBuilder& builder) { |
| 89 | absl::Status status; |
| 90 | CEL_ASSIGN_OR_RETURN( |
| 91 | auto func1, cel::MakeFunctionDecl( |
| 92 | "testFunc1", MakeOverloadDecl(StringType()))); |
| 93 | status.Update(builder.AddFunction(func1)); |
| 94 | if (version == 2) { |
| 95 | CEL_ASSIGN_OR_RETURN( |
| 96 | auto func2, |
| 97 | cel::MakeFunctionDecl("testFunc2", |
| 98 | MakeOverloadDecl(StringType()))); |
| 99 | status.Update(builder.AddFunction(func2)); |
| 100 | } |
| 101 | return status; |
| 102 | }) {}; |
| 103 | }; |
| 104 | |
| 105 | absl::StatusOr<cel::Value> CompileAndEvalExpr( |
nothing calls this directly
no test coverage detected