| 56 | }; |
| 57 | |
| 58 | TEST_F(FunctionAdapterTest, UnaryFunctionAdapterWrapFunctionOldOverload) { |
| 59 | using FunctionAdapter = UnaryFunctionAdapter<StringValue, const StringValue&>; |
| 60 | |
| 61 | std::unique_ptr<Function> wrapped = FunctionAdapter::WrapFunction( |
| 62 | [](const StringValue& x, |
| 63 | const Function::InvokeContext& context) -> StringValue { |
| 64 | std::string buf; |
| 65 | absl::string_view s = x.ToStringView(&buf); |
| 66 | buf = absl::StrCat("pre_", s); |
| 67 | return StringValue::From(std::move(buf), context.arena()); |
| 68 | }); |
| 69 | |
| 70 | std::vector<Value> args{StringValue::Wrap(absl::string_view("foo"), arena())}; |
| 71 | ASSERT_OK_AND_ASSIGN( |
| 72 | auto result, |
| 73 | wrapped->Invoke(args, descriptor_pool(), message_factory(), arena())); |
| 74 | |
| 75 | EXPECT_THAT(result, test::StringValueIs("pre_foo")); |
| 76 | ASSERT_OK_AND_ASSIGN(result, wrapped->Invoke(args, test_invoke_context())); |
| 77 | |
| 78 | EXPECT_THAT(result, test::StringValueIs("pre_foo")); |
| 79 | } |
| 80 | |
| 81 | TEST_F(FunctionAdapterTest, UnaryFunctionAdapterWrapFunctionInt) { |
| 82 | using FunctionAdapter = UnaryFunctionAdapter<int64_t, int64_t>; |
nothing calls this directly
no test coverage detected