Skip to content

Commit 10a6856

Browse files
committed
fixing
1 parent 1a024aa commit 10a6856

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed

module/core/former/plan.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,26 @@ When `cargo test` fails after uncommenting a test group (`_derive`, `_manual`, `
126126
* Crucial Design Rules: [Structuring: Add Module Declaration Before Content](#structuring-add-module-declaration-before-content), [Minimal Changes](#enhancements-only-implement-whats-requested)
127127
* Verification Strategy: Expect compilation success (`cargo check`) and zero tests run for `former_enum_tests` (`cargo test`). **Analyze logs critically.**
128128

129-
* [] **Increment 2:** Uncomment and Test Basic Enum (`basic_*`)
130-
* **Requirement:** Uncomment `basic_derive`, `basic_manual`, and `basic_only_test` modules. Perform pre-analysis against "Expected Enum Former Behavior" (default subformer for single-field tuple). Address any `xxx`/`qqq` tasks in `basic_derive.rs`. Verify compilation and test success, diagnosing and fixing failures according to the "Failure Diagnosis Algorithm". Ensure `_derive` and `_manual` align with expected behavior.
129+
* [] **Increment 2:** Uncomment and Test Basic Enum (`basic_*`)
130+
* **Goal:** Activate and verify the tests for the basic enum `FunctionStep` involving single-field tuple variants holding `Former`-derived types.
131+
* **Detailed Plan Step 1:** Modify `module/core/former/tests/inc/mod.rs`. In the `mod former_enum_tests` block, uncomment the following lines:
132+
```rust
133+
mod basic_manual;
134+
mod basic_derive;
135+
// Note: basic_only_test.rs is included by the above, no direct mod line needed.
136+
```
137+
* **Detailed Plan Step 2:** Modify `module/core/former/tests/inc/former_enum_tests/basic_derive.rs`. Remove the `// xxx : generated code for debugging` comments and the `// qqq : xxx : uncomment and make it working` comment, as the relevant code is already present and uncommented.
138+
* **Pre-Analysis:**
139+
* The enum `FunctionStep` has two variants: `Break(Break)` and `Run(Run)`. Both are single-field tuple variants holding types that derive `Former`.
140+
* The `basic_derive.rs` file uses `#[derive(Former)]` and `#[former(standalone_constructors)]`.
141+
* **Expected Behavior (Rule 3d & 4):** The derive macro should generate standalone constructor functions `break()` and `run()` that return the respective subformers (`BreakFormer`, `RunFormer`). This matches the logic in `basic_manual.rs`.
142+
* **Test Logic (`basic_only_test.rs`):** Tests call `FunctionStep::r#break()` and `FunctionStep::run()`, use the returned former's setters (`.condition()`, `.command()`), and call `.form()`.
143+
* **Prediction:** Tests are expected to pass if the derive macro correctly implements the default subformer behavior for single-field tuple variants and standalone constructors.
144+
* **Crucial Design Rules:** [Proc Macro: Development Workflow](#proc-macro-development-workflow), "Expected Enum Former Behavior" rules 3d, 4.
145+
* **Verification Strategy:**
146+
1. Request user run `cargo check --tests --package former`. Expect success.
147+
2. Request user run `cargo test --package former --test tests -- --test-threads=1 --nocapture former_enum_tests::basic`. Expect tests `build_break_variant_static` and `build_run_variant_static` to pass.
148+
3. Analyze logs critically using the "Failure Diagnosis Algorithm" if failures occur.
131149

132150
* [⚫] **Increment 3:** Uncomment and Test Enum Named Fields (`enum_named_fields_*`)
133151
* **Requirement:** Uncomment `enum_named_fields_derive`, `enum_named_fields_manual`, and `enum_named_fields_only_test` modules. Perform pre-analysis against "Expected Enum Former Behavior" (scalar vs. subform vs. implicit former based on attributes and field count). Verify compilation and test success, diagnosing and fixing failures according to the "Failure Diagnosis Algorithm". Ensure `_derive` and `_manual` align with expected behavior.

module/core/former/tests/inc/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -235,11 +235,11 @@ mod former_enum_tests
235235

236236
// xxx : qqq : enable or remove
237237
// mod usecase1;
238-
//
239-
// mod basic_manual;
240-
// mod basic_derive;
241-
// mod unit_variant_manual;
242-
// mod unit_variant_derive;
238+
239+
mod basic_manual;
240+
mod basic_derive;
241+
mod unit_variant_manual;
242+
mod unit_variant_derive;
243243
// mod enum_named_fields_manual;
244244
// mod enum_named_fields_derive;
245245
//

0 commit comments

Comments
 (0)