Tests error when not enough list elements are on the stack during list creation.
| 157 | // Tests error when not enough list elements are on the stack during list |
| 158 | // creation. |
| 159 | TEST(CreateListStepTest, TestCreateListStackUnderflow) { |
| 160 | ExecutionPath path; |
| 161 | Expr dummy_expr; |
| 162 | |
| 163 | auto& create_list = dummy_expr.mutable_list_expr(); |
| 164 | auto& expr0 = create_list.mutable_elements().emplace_back().mutable_expr(); |
| 165 | expr0.mutable_const_expr().set_int64_value(1); |
| 166 | |
| 167 | ASSERT_OK_AND_ASSIGN(auto step0, |
| 168 | CreateCreateListStep(create_list, dummy_expr.id())); |
| 169 | path.push_back(std::move(step0)); |
| 170 | |
| 171 | auto env = NewTestingRuntimeEnv(); |
| 172 | CelExpressionFlatImpl cel_expr( |
| 173 | env, FlatExpression(std::move(path), /*comprehension_slot_count=*/0, |
| 174 | env->type_registry.GetComposedTypeProvider(), |
| 175 | cel::RuntimeOptions{})); |
| 176 | Activation activation; |
| 177 | |
| 178 | google::protobuf::Arena arena; |
| 179 | |
| 180 | auto status = cel_expr.Evaluate(activation, &arena); |
| 181 | ASSERT_THAT(status, Not(IsOk())); |
| 182 | } |
| 183 | |
| 184 | TEST_P(CreateListStepTest, CreateListEmpty) { |
| 185 | ASSERT_OK_AND_ASSIGN(CelValue result, |
nothing calls this directly
no test coverage detected