TODO(uncreated-issue/48): replace this with a parsed expr when the non-protobuf parser is available.
| 62 | // TODO(uncreated-issue/48): replace this with a parsed expr when the non-protobuf |
| 63 | // parser is available. |
| 64 | absl::StatusOr<Value> TestDispatchToFunction( |
| 65 | const FunctionRegistry& registry, absl::string_view simple_name, |
| 66 | absl::Span<const Value> args, |
| 67 | const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool, |
| 68 | google::protobuf::MessageFactory* absl_nonnull message_factory, |
| 69 | google::protobuf::Arena* absl_nonnull arena) { |
| 70 | std::vector<Kind> arg_matcher_; |
| 71 | arg_matcher_.reserve(args.size()); |
| 72 | for (const auto& value : args) { |
| 73 | arg_matcher_.push_back(ValueKindToKind(value->kind())); |
| 74 | } |
| 75 | std::vector<FunctionOverloadReference> refs = registry.FindStaticOverloads( |
| 76 | simple_name, /*receiver_style=*/false, arg_matcher_); |
| 77 | |
| 78 | if (refs.size() != 1) { |
| 79 | return absl::InvalidArgumentError("ambiguous overloads"); |
| 80 | } |
| 81 | |
| 82 | return refs[0].implementation.Invoke(args, descriptor_pool, message_factory, |
| 83 | arena); |
| 84 | } |
| 85 | |
| 86 | TEST(RegisterLogicalFunctions, NotStrictlyFalseRegistered) { |
| 87 | FunctionRegistry registry; |
no test coverage detected