| 102 | }; |
| 103 | |
| 104 | TEST_F(RegexFunctionsTest, CaptureStringSuccessWithCombinationOfGroups) { |
| 105 | // combination of named and unnamed groups should return a celmap |
| 106 | EXPECT_THAT( |
| 107 | TestEvaluate((R"cel( |
| 108 | re.captureN( |
| 109 | 'The user testuser belongs to testdomain', |
| 110 | 'The (user|domain) (?P<Username>.*) belongs to (?P<Domain>.*)' |
| 111 | ) |
| 112 | )cel")), |
| 113 | IsOkAndHolds(MapValueIs(MapValueElements( |
| 114 | UnorderedElementsAre( |
| 115 | Pair(StringValueIs("1"), StringValueIs("user")), |
| 116 | Pair(StringValueIs("Username"), StringValueIs("testuser")), |
| 117 | Pair(StringValueIs("Domain"), StringValueIs("testdomain"))), |
| 118 | descriptor_pool_, message_factory_, &arena_)))); |
| 119 | } |
| 120 | |
| 121 | TEST_F(RegexFunctionsTest, CaptureStringSuccessWithSingleNamedGroup) { |
| 122 | // Regex containing one named group should return a map |
nothing calls this directly
no test coverage detected