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

Function ASSERT_OK_AND_ASSIGN

env/env_test.cc:170–209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

168
169 ASSERT_OK_AND_ASSIGN(std::unique_ptr<Compiler> compiler, env_.NewCompiler());
170 ASSERT_OK_AND_ASSIGN(auto result1, compiler->Compile("testMacro1()"));
171 ASSERT_OK_AND_ASSIGN(auto result2, compiler->Compile("testFunc1()"));
172 ASSERT_OK_AND_ASSIGN(auto result3, compiler->Compile("testMacro2()"));
173 ASSERT_OK_AND_ASSIGN(auto result4, compiler->Compile("testFunc2()"));
174
175 EXPECT_THAT(result1.GetIssues(), IsEmpty());
176 EXPECT_THAT(result2.GetIssues(), IsEmpty());
177 EXPECT_THAT(result3.GetIssues(), IsEmpty());
178 EXPECT_THAT(result4.GetIssues(), IsEmpty());
179}
180
181TEST_F(LibraryConfigTest, SpecificVersion) {
182 Config config;
183 ASSERT_THAT(config.AddExtensionConfig("testlib", 1), IsOk());
184
185 env_.SetConfig(config);
186
187 ASSERT_OK_AND_ASSIGN(std::unique_ptr<Compiler> compiler, env_.NewCompiler());
188 ASSERT_OK_AND_ASSIGN(auto result1, compiler->Compile("testMacro1()"));
189 ASSERT_OK_AND_ASSIGN(auto result2, compiler->Compile("testFunc1()"));
190 ASSERT_OK_AND_ASSIGN(auto result3, compiler->Compile("testMacro2()"));
191 ASSERT_OK_AND_ASSIGN(auto result4, compiler->Compile("testFunc2()"));
192
193 EXPECT_THAT(result1.GetIssues(), IsEmpty());
194 EXPECT_THAT(result2.GetIssues(), IsEmpty());
195 EXPECT_THAT(result3.GetIssues(),
196 UnorderedElementsAre(
197 Property(&TypeCheckIssue::message,
198 HasSubstr("undeclared reference to 'testMacro2'"))));
199 EXPECT_THAT(result4.GetIssues(),
200 UnorderedElementsAre(
201 Property(&TypeCheckIssue::message,
202 HasSubstr("undeclared reference to 'testFunc2'"))));
203}
204
205struct StandardLibraryConfigTestCase {
206 Config::StandardLibraryConfig standard_library_config;
207 std::vector<std::string> expected_valid_expressions;
208 std::vector<std::string> expected_invalid_expressions;
209};
210
211class StandardLibraryConfigTest
212 : public testing::TestWithParam<StandardLibraryConfigTestCase> {};

Callers 8

TEST_PFunction · 0.70
TEST_PFunction · 0.70
env_test.ccFile · 0.70
TEST_PFunction · 0.70
TEST_PFunction · 0.70
TESTFunction · 0.70
TESTFunction · 0.50
TESTFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected