MCPcopy Create free account
hub / github.com/cel-expr/cel-cpp / TEST_F

Function TEST_F

extensions/regex_functions_test.cc:104–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102};
103
104TEST_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
121TEST_F(RegexFunctionsTest, CaptureStringSuccessWithSingleNamedGroup) {
122 // Regex containing one named group should return a map

Callers

nothing calls this directly

Calls 2

MapValueIsFunction · 0.85
StringValueIsFunction · 0.85

Tested by

no test coverage detected