| 209 | using NonStrictRegistrationFailTest = testing::TestWithParam<NonStrictTestCase>; |
| 210 | |
| 211 | TEST_P(NonStrictRegistrationFailTest, |
| 212 | IfOtherOverloadExistsRegisteringNonStrictFails) { |
| 213 | bool existing_function_is_lazy, new_function_is_lazy; |
| 214 | std::tie(existing_function_is_lazy, new_function_is_lazy) = GetParam(); |
| 215 | FunctionRegistry registry; |
| 216 | cel::FunctionDescriptor descriptor("OverloadedFunction", |
| 217 | /*receiver_style=*/false, {Kind::kAny}, |
| 218 | /*is_strict=*/true); |
| 219 | if (existing_function_is_lazy) { |
| 220 | ASSERT_OK(registry.RegisterLazyFunction(descriptor)); |
| 221 | } else { |
| 222 | ASSERT_OK( |
| 223 | registry.Register(descriptor, std::make_unique<ConstIntFunction>())); |
| 224 | } |
| 225 | cel::FunctionDescriptor new_descriptor("OverloadedFunction", |
| 226 | /*receiver_style=*/false, |
| 227 | {Kind::kAny, Kind::kAny}, |
| 228 | /*is_strict=*/false); |
| 229 | absl::Status status; |
| 230 | if (new_function_is_lazy) { |
| 231 | status = registry.RegisterLazyFunction(new_descriptor); |
| 232 | } else { |
| 233 | status = |
| 234 | registry.Register(new_descriptor, std::make_unique<ConstIntFunction>()); |
| 235 | } |
| 236 | EXPECT_THAT(status, StatusIs(absl::StatusCode::kAlreadyExists, |
| 237 | HasSubstr("Only one overload"))); |
| 238 | } |
| 239 | |
| 240 | TEST_P(NonStrictRegistrationFailTest, |
| 241 | IfOtherNonStrictExistsRegisteringStrictFails) { |
nothing calls this directly
no test coverage detected