| 140 | } |
| 141 | |
| 142 | absl::StatusOr<std::unique_ptr<cel::Compiler>> NewTestCompiler() { |
| 143 | CompilerOptions options; |
| 144 | options.parser_options.enable_quoted_identifiers = true; |
| 145 | CEL_ASSIGN_OR_RETURN(std::unique_ptr<cel::CompilerBuilder> builder, |
| 146 | cel::NewCompilerBuilder( |
| 147 | google::protobuf::DescriptorPool::generated_pool(), options)); |
| 148 | |
| 149 | CEL_RETURN_IF_ERROR(builder->AddLibrary(cel::StandardCompilerLibrary())); |
| 150 | CEL_RETURN_IF_ERROR(builder->AddLibrary(cel::OptionalCompilerLibrary())); |
| 151 | auto& checker_builder = builder->GetCheckerBuilder(); |
| 152 | google::protobuf::LinkMessageReflection<conformancepb::proto2::TestAllTypes>(); |
| 153 | |
| 154 | checker_builder.set_container("cel.expr.conformance"); |
| 155 | |
| 156 | CEL_RETURN_IF_ERROR(ApplyDecl( |
| 157 | R"pb( |
| 158 | name: "nested_test_all_types" |
| 159 | ident { |
| 160 | type { |
| 161 | message_type: "cel.expr.conformance.proto2.NestedTestAllTypes" |
| 162 | } |
| 163 | } |
| 164 | )pb", |
| 165 | checker_builder)); |
| 166 | CEL_RETURN_IF_ERROR(ApplyDecl( |
| 167 | R"pb( |
| 168 | name: "test_all_types" |
| 169 | ident { |
| 170 | type { message_type: "cel.expr.conformance.proto2.TestAllTypes" } |
| 171 | } |
| 172 | )pb", |
| 173 | checker_builder)); |
| 174 | CEL_RETURN_IF_ERROR(ApplyDecl( |
| 175 | R"pb( |
| 176 | name: "a" |
| 177 | ident { |
| 178 | type { |
| 179 | message_type: "cel.expr.conformance.proto2.NestedTestAllTypes" |
| 180 | } |
| 181 | } |
| 182 | )pb", |
| 183 | checker_builder)); |
| 184 | |
| 185 | CEL_RETURN_IF_ERROR(ApplyDecl( |
| 186 | R"pb( |
| 187 | name: "b" |
| 188 | ident { |
| 189 | type { |
| 190 | message_type: "cel.expr.conformance.proto2.NestedTestAllTypes" |
| 191 | } |
| 192 | } |
| 193 | )pb", |
| 194 | checker_builder)); |
| 195 | |
| 196 | CEL_RETURN_IF_ERROR(ApplyDecl( |
| 197 | R"pb( |
| 198 | name: "custom_predicate" |
| 199 | function { |
no test coverage detected