Skip to content

Commit eb195ac

Browse files
manuzhangcodex
andcommitted
test: cover forbidden nested type promotions
Assert that promotion helpers reject nested type targets for unknown and regular primitive source types. Co-authored-by: Codex <codex@openai.com>
1 parent 8087ed1 commit eb195ac

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/iceberg/test/type_test.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,15 @@ INSTANTIATE_TEST_SUITE_P(Primitive, TypeTest, ::testing::ValuesIn(kPrimitiveType
258258
INSTANTIATE_TEST_SUITE_P(Nested, TypeTest, ::testing::ValuesIn(kNestedTypes),
259259
TypeTestCaseToString);
260260

261+
TEST(TypeTest, PromotionToNestedTypesIsForbidden) {
262+
for (const auto& nested_type : kNestedTypes) {
263+
SCOPED_TRACE(nested_type.name);
264+
265+
EXPECT_FALSE(iceberg::IsPromotionAllowed(iceberg::unknown(), nested_type.type));
266+
EXPECT_FALSE(iceberg::IsPromotionAllowed(iceberg::int32(), nested_type.type));
267+
}
268+
}
269+
261270
TEST(TypeTest, Equality) {
262271
std::vector<std::shared_ptr<iceberg::Type>> alltypes;
263272
for (const auto& test_case : kPrimitiveTypes) {

0 commit comments

Comments
 (0)