|
15 | 15 | //! |
16 | 16 | //! --- |
17 | 17 | //! |
18 | | -//! ## Test Matrix for Enum Unnamed (Tuple) Variants |
| 18 | +//! ## Test Matrix Coverage (Tuple Variants) |
19 | 19 | //! |
20 | | -//! This matrix guides the testing of `#[derive(Former)]` for enum unnamed (tuple) variants, |
21 | | -//! linking combinations of attributes and variant structures to expected behaviors and |
22 | | -//! relevant internal rule numbers. |
| 20 | +//! This plan focuses on verifying the behavior for **Tuple Variants**. The relevant factors and combinations tested by the relevant files are: |
23 | 21 | //! |
24 | | -//! --- |
25 | | -//! |
26 | | -//! **Factors:** |
27 | | -//! |
28 | | -//! 1. **Number of Fields:** |
29 | | -//! * Zero (`V()`) |
30 | | -//! * One (`V(T1)`) |
31 | | -//! * Multiple (`V(T1, T2, ...)`) |
32 | | -//! 2. **Field Type `T1` (for Single-Field Variants):** |
33 | | -//! * Derives `Former` |
34 | | -//! * Does NOT derive `Former` |
35 | | -//! 3. **Variant-Level Attribute:** |
36 | | -//! * None (Default behavior) |
37 | | -//! * `#[scalar]` |
38 | | -//! * `#[subform_scalar]` |
39 | | -//! 4. **Enum-Level Attribute:** |
40 | | -//! * None |
41 | | -//! * `#[standalone_constructors]` |
42 | | -//! 5. **Field-Level Attribute `#[arg_for_constructor]` (within `#[standalone_constructors]` context):** |
43 | | -//! * Not applicable (for zero-field) |
44 | | -//! * On the single field (for one-field) |
45 | | -//! * On all fields / some fields / no fields (for multi-field) |
46 | | -//! |
47 | | -//! --- |
48 | | -//! |
49 | | -//! **Combinations for Zero-Field Tuple Variants (`V()`):** |
50 | | -//! |
51 | | -//! | # | Variant Attr | Enum Attr | Expected Static Method | Expected Standalone Constructor | Rule(s) | Handler (Meta) | |
52 | | -//! |----|--------------|-----------------------------|-------------------------------|---------------------------------|---------|--------------------------------| |
53 | | -//! | T0.1| Default | None | `Enum::v() -> Enum` | N/A | 3b | `tuple_zero_fields_handler.rs` | |
54 | | -//! | T0.2| `#[scalar]` | None | `Enum::v() -> Enum` | N/A | 1b | `tuple_zero_fields_handler.rs` | |
55 | | -//! | T0.3| Default | `#[standalone_constructors]`| `Enum::v() -> Enum` | `fn v() -> Enum` | 3b, 4 | `tuple_zero_fields_handler.rs` | |
56 | | -//! | T0.4| `#[scalar]` | `#[standalone_constructors]`| `Enum::v() -> Enum` | `fn v() -> Enum` | 1b, 4 | `tuple_zero_fields_handler.rs` | |
57 | | -//! | T0.5| `#[subform_scalar]` | (Any) | *Compile Error* | *Compile Error* | 2b | (Dispatch) | |
58 | | -//! |
59 | | -//! --- |
60 | | -//! |
61 | | -//! **Combinations for Single-Field Tuple Variants (`V(T1)`):** |
62 | | -//! |
63 | | -//! | # | Variant Attr | T1 Derives Former | Enum Attr | Expected Static Method | Expected Standalone Constructor | Rule(s) | Handler (Meta) | |
64 | | -//! |-----|-------------------|-------------------|-----------------------------|-------------------------------|---------------------------------|-------------|--------------------------------| |
65 | | -//! | T1.1| Default | Yes | None | `Enum::variant() -> T1Former` | N/A | 3d.i | `tuple_single_field_subform.rs`| |
66 | | -//! | T1.2| Default | No | None | `Enum::variant(T1) -> Enum` | N/A | 3d.ii | `tuple_single_field_scalar.rs` | |
67 | | -//! | T1.3| `#[scalar]` | Any | None | `Enum::variant(T1) -> Enum` | N/A | 1d | `tuple_single_field_scalar.rs` | |
68 | | -//! | T1.4| `#[subform_scalar]`| Yes | None | `Enum::variant() -> T1Former` | N/A | 2d | `tuple_single_field_subform.rs`| |
69 | | -//! | T1.5| `#[subform_scalar]`| No | None | *Compile Error* | *Compile Error* | 2d | (Dispatch) | |
70 | | -//! | T1.6| Default | Yes | `#[standalone_constructors]`| `Enum::variant() -> T1Former` | `fn variant() -> T1Former` | 3d.i, 4 | `tuple_single_field_subform.rs`| |
71 | | -//! | T1.7| Default | No | `#[standalone_constructors]`| `Enum::variant(T1) -> Enum` | `fn variant(T1) -> Enum` | 3d.ii, 4 | `tuple_single_field_scalar.rs` | |
72 | | -//! | T1.8| `#[scalar]` | Any | `#[standalone_constructors]`| `Enum::variant(T1) -> Enum` | `fn variant(T1) -> Enum` | 1d, 4 | `tuple_single_field_scalar.rs` | |
73 | | -//! | T1.9| `#[subform_scalar]`| Yes | `#[standalone_constructors]`| `Enum::variant() -> T1Former` | `fn variant() -> T1Former` | 2d, 4 | `tuple_single_field_subform.rs`| |
74 | | -//! | T1.10| `#[subform_scalar]`| No | `#[standalone_constructors]`| *Compile Error* | *Compile Error* | 2d | (Dispatch) | |
75 | | -//! |
76 | | -//! Note: The effect of `#[arg_for_constructor]` is covered by Rule 4 in conjunction with the base behavior. |
77 | | -//! |
78 | | -//! --- |
79 | | -//! |
80 | | -//! **Combinations for Multi-Field Tuple Variants (`V(T1, T2, ...)`):** |
81 | | -//! |
82 | | -//! | # | Variant Attr | Enum Attr | Expected Static Method | Expected Standalone Constructor | Rule(s) | Handler (Meta) | |
83 | | -//! |-----|--------------|-----------------------------|-------------------------------|---------------------------------|---------|--------------------------------| |
84 | | -//! | TN.1| Default | None | `Enum::variant(T1, T2,...) -> Enum` | N/A | 3f | `tuple_multi_fields_scalar.rs` | |
85 | | -//! | TN.2| `#[scalar]` | None | `Enum::variant(T1, T2,...) -> Enum` | N/A | 1f | `tuple_multi_fields_scalar.rs` | |
86 | | -//! | TN.3| `#[subform_scalar]` | (Any) | *Compile Error* | *Compile Error* | 2f | (Dispatch) | |
87 | | -//! | TN.4| Default | `#[standalone_constructors]`| `Enum::variant(T1, T2,...) -> Enum` | `fn variant(T1, T2,...) -> Enum` | 3f, 4 | `tuple_multi_fields_scalar.rs` | |
88 | | -//! | TN.5| `#[scalar]` | `#[standalone_constructors]`| `Enum::variant(T1, T2,...) -> Enum` | `fn variant(T1, T2,...) -> Enum` | 1f, 4 | `tuple_multi_fields_scalar.rs` | |
| 22 | +//! * **Factors:** |
| 23 | +//! 1. Variant Type: Tuple (Implicitly selected) |
| 24 | +//! 2. Number of Fields: Zero (`V()`), One (`V(T1)`), Multiple (`V(T1, T2, ...)`) |
| 25 | +//! 3. Field Type `T1` (for Single-Field): Derives `Former`, Does NOT derive `Former` |
| 26 | +//! 4. Variant-Level Attribute: None (Default), `#[scalar]`, `#[subform_scalar]` |
| 27 | +//! 5. Enum-Level Attribute: None, `#[standalone_constructors]` |
| 28 | +//! 6. Field-Level Attribute `#[arg_for_constructor]` (within `#[standalone_constructors]` context): N/A, On single field, On all/some/no fields (multi) |
| 29 | +//! |
| 30 | +//! * **Combinations Covered (Mapped to Rules & Test Files):** |
| 31 | +//! * **Zero-Field (`V()`):** |
| 32 | +//! * T0.1 (Default): Rule 3b (`enum_named_fields_*`) |
| 33 | +//! * T0.2 (`#[scalar]`): Rule 1b (`enum_named_fields_*`) |
| 34 | +//! * T0.3 (Default + Standalone): Rule 3b, 4 (`enum_named_fields_*`) |
| 35 | +//! * T0.4 (`#[scalar]` + Standalone): Rule 1b, 4 (`enum_named_fields_*`) |
| 36 | +//! * T0.5 (`#[subform_scalar]`): Rule 2b (Error - `compile_fail/tuple_zero_subform_scalar_error.rs`) |
| 37 | +//! * **Single-Field (`V(T1)`):** |
| 38 | +//! * T1.1 (Default, T1 derives Former): Rule 3d.i (`basic_*`, `generics_in_tuple_variant_*`, `generics_shared_tuple_*`, `usecase1.rs`) |
| 39 | +//! * T1.2 (Default, T1 not Former): Rule 3d.ii (Needs specific test file if not covered implicitly) |
| 40 | +//! * T1.3 (`#[scalar]`): Rule 1d (`generics_independent_tuple_*`, `scalar_generic_tuple_*`, `keyword_variant_*`) |
| 41 | +//! * T1.4 (`#[subform_scalar]`, T1 derives Former): Rule 2d (Needs specific test file if not covered implicitly) |
| 42 | +//! * T1.5 (`#[subform_scalar]`, T1 not Former): Rule 2d (Error - `compile_fail/tuple_single_subform_non_former_error.rs`) |
| 43 | +//! * T1.6 (Default, T1 derives Former + Standalone): Rule 3d.i, 4 (`standalone_constructor_*`) |
| 44 | +//! * T1.7 (Default, T1 not Former + Standalone): Rule 3d.ii, 4 (Needs specific test file if not covered implicitly) |
| 45 | +//! * T1.8 (`#[scalar]` + Standalone): Rule 1d, 4 (`standalone_constructor_args_*`) |
| 46 | +//! * T1.9 (`#[subform_scalar]`, T1 derives Former + Standalone): Rule 2d, 4 (Needs specific test file if not covered implicitly) |
| 47 | +//! * T1.10 (`#[subform_scalar]`, T1 not Former + Standalone): Rule 2d (Error - Covered by T1.5) |
| 48 | +//! * **Multi-Field (`V(T1, T2, ...)`):** |
| 49 | +//! * TN.1 (Default): Rule 3f (Needs specific test file if not covered implicitly by TN.4) |
| 50 | +//! * TN.2 (`#[scalar]`): Rule 1f (`keyword_variant_*`, `standalone_constructor_args_*`) |
| 51 | +//! * TN.3 (`#[subform_scalar]`): Rule 2f (Error - `compile_fail/tuple_multi_subform_scalar_error.rs`) |
| 52 | +//! * TN.4 (Default + Standalone): Rule 3f, 4 (Needs specific test file, potentially `standalone_constructor_args_*` if adapted) |
| 53 | +//! * TN.5 (`#[scalar]` + Standalone): Rule 1f, 4 (`standalone_constructor_args_*`) |
89 | 54 | //! |
90 | 55 | //! Note: The effect of `#[arg_for_constructor]` is covered by Rule 4 in conjunction with the base behavior. |
91 | 56 | //! |
|
0 commit comments