Skip to main content

Module embed_enum_data

Module embed_enum_data 

Source

Functions§

data_carrying_enum_db_schema
Verifies DB columns for a data-carrying enum: discriminant column + one nullable column per variant field, named {disc_col}_{field_name}.
data_carrying_enum_schema
Verifies that a data-carrying enum has its variant fields registered in the app schema with globally-assigned field indices (indices are unique across all variants).
data_variant_roundtrip
End-to-end CRUD test for a data-carrying enum (all variants have fields). Creates records with different variants, reads them back, and verifies roundtrip.
data_variant_with_jiff_timestamp
Tests that jiff::Timestamp fields inside data-carrying enum variants round-trip correctly. Also covers a mixed enum (one unit variant, one data variant) to verify null handling.
data_variant_with_uuid_field
Tests that UUID fields inside data-carrying enum variants round-trip correctly. UUID is a non-trivial primitive that requires type casting on some databases.
enum_in_enum_roundtrip
Roundtrip test for an enum embedded inside a variant field of another enum (enum-in-enum). The inner enum is unit-only; the outer has one data variant and one unit variant.
enum_update_between_variants_of_different_width
Updating a data-carrying enum between variants with different field counts round-trips. The narrower variant’s value record is shorter than the wider variant’s data columns expect, exercising the same out-of-bounds projection path as #1068 without any unit variant involved.
global_field_indices
Verifies field indices are assigned globally across multiple data variants. With two variants having two fields each, indices should be 0, 1, 2, 3.
mixed_enum_roundtrip
End-to-end CRUD test for a mixed enum (unit variants and data variants). Verifies that both kinds round-trip correctly through the DB.
mixed_enum_schema
Verifies that a mixed enum (some unit variants, some data variants) registers correctly: unit variants have empty fields, data variants have their fields with indices assigned starting from 0 and continuing globally across variants.
mixed_enum_update_data_to_unit_variant
Updating a mixed enum field from a data-carrying variant to a unit variant (and back) round-trips correctly. Regression test for #1068: the unit variant’s value record is narrower than the data variant’s data column expects, which used to panic while lowering the update.
struct_in_data_variant