| 45 | } |
| 46 | |
| 47 | TEST(RegisterStringFunctions, FunctionsRegistered) { |
| 48 | FunctionRegistry registry; |
| 49 | RuntimeOptions options; |
| 50 | |
| 51 | ASSERT_OK(RegisterStringFunctions(registry, options)); |
| 52 | auto overloads = registry.ListFunctions(); |
| 53 | |
| 54 | EXPECT_THAT( |
| 55 | overloads[builtin::kAdd], |
| 56 | UnorderedElementsAre( |
| 57 | MatchesDescriptor(builtin::kAdd, CallStyle::kFree, |
| 58 | std::vector<Kind>{Kind::kString, Kind::kString}), |
| 59 | MatchesDescriptor(builtin::kAdd, CallStyle::kFree, |
| 60 | std::vector<Kind>{Kind::kBytes, Kind::kBytes}))); |
| 61 | |
| 62 | EXPECT_THAT(overloads[builtin::kSize], |
| 63 | UnorderedElementsAre( |
| 64 | MatchesDescriptor(builtin::kSize, CallStyle::kFree, |
| 65 | std::vector<Kind>{Kind::kString}), |
| 66 | MatchesDescriptor(builtin::kSize, CallStyle::kFree, |
| 67 | std::vector<Kind>{Kind::kBytes}), |
| 68 | MatchesDescriptor(builtin::kSize, CallStyle::kReceiver, |
| 69 | std::vector<Kind>{Kind::kString}), |
| 70 | MatchesDescriptor(builtin::kSize, CallStyle::kReceiver, |
| 71 | std::vector<Kind>{Kind::kBytes}))); |
| 72 | |
| 73 | EXPECT_THAT( |
| 74 | overloads[builtin::kStringContains], |
| 75 | UnorderedElementsAre( |
| 76 | MatchesDescriptor(builtin::kStringContains, CallStyle::kFree, |
| 77 | std::vector<Kind>{Kind::kString, Kind::kString}), |
| 78 | |
| 79 | MatchesDescriptor(builtin::kStringContains, CallStyle::kReceiver, |
| 80 | std::vector<Kind>{Kind::kString, Kind::kString}))); |
| 81 | EXPECT_THAT( |
| 82 | overloads[builtin::kStringStartsWith], |
| 83 | UnorderedElementsAre( |
| 84 | MatchesDescriptor(builtin::kStringStartsWith, CallStyle::kFree, |
| 85 | std::vector<Kind>{Kind::kString, Kind::kString}), |
| 86 | |
| 87 | MatchesDescriptor(builtin::kStringStartsWith, CallStyle::kReceiver, |
| 88 | std::vector<Kind>{Kind::kString, Kind::kString}))); |
| 89 | EXPECT_THAT( |
| 90 | overloads[builtin::kStringEndsWith], |
| 91 | UnorderedElementsAre( |
| 92 | MatchesDescriptor(builtin::kStringEndsWith, CallStyle::kFree, |
| 93 | std::vector<Kind>{Kind::kString, Kind::kString}), |
| 94 | |
| 95 | MatchesDescriptor(builtin::kStringEndsWith, CallStyle::kReceiver, |
| 96 | std::vector<Kind>{Kind::kString, Kind::kString}))); |
| 97 | } |
| 98 | |
| 99 | TEST(RegisterStringFunctions, ConcatSkippedWhenDisabled) { |
| 100 | FunctionRegistry registry; |
nothing calls this directly
no test coverage detected