Skip to content

Commit ae589c8

Browse files
committed
docs(unilang): Add test matrix documentation to integration tests
1 parent 376a05f commit ae589c8

File tree

2 files changed

+40
-120
lines changed

2 files changed

+40
-120
lines changed

module/move/unilang/plan.md

Lines changed: 14 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -1,142 +1,41 @@
1-
# Project Plan: Unilang Codestyle and Documentation Review
1+
# Project Plan: Unilang Test File Documentation
22

33
### Goal
4-
* Iterate through each file of the `unilang` crate, ensuring all code adheres to the established codestyle rules and has concise, accurate documentation.
4+
* Add comprehensive documentation to all test files, including references to the Test Matrix, to ensure clarity and maintainability.
55

66
### Progress
7-
*Codestyle Review Complete
7+
*Test Documentation Complete
88

99
### Target Crate
1010
* module/move/unilang
1111

1212
### Relevant Context
1313
* Files to Include (for AI's reference, if `read_file` is planned, primarily from Target Crate):
14-
* All `.rs` files within `module/move/unilang/src` and `module/move/unilang/tests`.
14+
* `module/move/unilang/tests/inc/phase1/full_pipeline_test.rs`
1515

1616
### Expected Behavior Rules / Specifications (for Target Crate)
17-
* All files must pass `cargo clippy` with the workspace lint settings without warnings.
18-
* All public items should have clear, concise documentation.
19-
* Code formatting should be consistent across the entire crate.
17+
* Test functions should have doc comments explaining their purpose.
18+
* Each test function should reference the Test Matrix row(s) it covers.
2019

2120
### Target File Structure (If Applicable, within Target Crate)
2221
* No changes to the file structure are planned.
2322

2423
### Increments
2524

26-
* ✅ Increment 1: Review `src/lib.rs`
27-
* Detailed Plan Step 1: Read the content of `src/lib.rs`.
28-
* Detailed Plan Step 2: Apply codestyle fixes, including adding documentation for all public modules.
29-
* Detailed Plan Step 3: Use `mod_interface` to structure the crate's public API.
30-
* Pre-Analysis: The `lib.rs` file is the entry point to the crate and should be well-documented and structured.
31-
* Crucial Design Rules: [Structuring: Modules with `mod_interface`](#structuring-modules-with-mod_interface), [Comments and Documentation](#comments-and-documentation)
32-
* Relevant Behavior Rules: N/A
33-
* Verification Strategy: Run `cargo build -p unilang` to ensure the changes compile.
34-
* Commit Message: "style(unilang): Clean up and document src/lib.rs"
35-
* ✅ Increment 2: Review `src/data.rs`
36-
* Detailed Plan Step 1: Read the content of `src/data.rs`.
37-
* Detailed Plan Step 2: Apply codestyle fixes (spacing, newlines, etc.).
38-
* Detailed Plan Step 3: Add concise documentation to all public structs and their fields.
39-
* Detailed Plan Step 4: Re-enable the `former` crate derive macros and attributes and fix any resulting compilation errors.
40-
* Pre-Analysis: The file contains core data structures. The `former` derive is currently commented out and needs to be re-enabled and fixed.
41-
* Crucial Design Rules: [Comments and Documentation](#comments-and-documentation)
42-
* Relevant Behavior Rules: N/A
43-
* Verification Strategy: Run `cargo build -p unilang` to ensure the changes compile without errors or warnings.
44-
* Commit Message: "style(unilang): Clean up and document src/data.rs"
45-
* ✅ Increment 3: Review `src/error.rs`
46-
* Detailed Plan Step 1: Read the content of `src/error.rs`.
47-
* Detailed Plan Step 2: Apply codestyle fixes (spacing, newlines, etc.).
48-
* Detailed Plan Step 3: Add concise documentation to the `Error` enum and its variants.
49-
* Pre-Analysis: The file contains the basic error enum. It needs proper documentation and formatting.
50-
* Crucial Design Rules: [Error Handling: Use a Centralized Approach](#error-handling-use-a-centralized-approach), [Comments and Documentation](#comments-and-documentation)
51-
* Relevant Behavior Rules: N/A
52-
* Verification Strategy: Run `cargo build -p unilang` to ensure the changes compile.
53-
* Commit Message: "style(unilang): Clean up and document src/error.rs"
54-
* ✅ Increment 4: Review `src/help.rs`
55-
* Detailed Plan Step 1: Read the content of `src/help.rs`.
56-
* Detailed Plan Step 2: Apply codestyle fixes (spacing, newlines, etc.).
57-
* Detailed Plan Step 3: Add concise documentation to the `HelpGenerator` struct and its methods.
58-
* Pre-Analysis: The file contains the basic help generator. It needs proper documentation and formatting.
59-
* Crucial Design Rules: [Comments and Documentation](#comments-and-documentation)
60-
* Relevant Behavior Rules: N/A
61-
* Verification Strategy: Run `cargo build -p unilang` to ensure the changes compile.
62-
* Commit Message: "style(unilang): Clean up and document src/help.rs"
63-
* ✅ Increment 5: Review `src/interpreter.rs`
64-
* Detailed Plan Step 1: Read the content of `src/interpreter.rs`.
65-
* Detailed Plan Step 2: Apply codestyle fixes (spacing, newlines, etc.).
66-
* Detailed Plan Step 3: Add concise documentation to the `Interpreter` and `ExecutionContext` structs and their methods.
67-
* Pre-Analysis: The file contains the basic interpreter. It needs proper documentation and formatting.
68-
* Crucial Design Rules: [Comments and Documentation](#comments-and-documentation)
69-
* Relevant Behavior Rules: N/A
70-
* Verification Strategy: Run `cargo build -p unilang` to ensure the changes compile.
71-
* Commit Message: "style(unilang): Clean up and document src/interpreter.rs"
72-
* ✅ Increment 6: Review `src/parsing.rs`
73-
* Detailed Plan Step 1: Read the content of `src/parsing.rs`.
74-
* Detailed Plan Step 2: Apply codestyle fixes (spacing, newlines, etc.).
75-
* Detailed Plan Step 3: Add concise documentation to all public items (`Token`, `Lexer`, `Parser`, `Statement`, `Program`) and their methods/variants/fields.
76-
* Pre-Analysis: The file contains the lexer and parser. It's a large file and will require careful review to ensure all items are documented and formatted correctly.
77-
* Crucial Design Rules: [Comments and Documentation](#comments-and-documentation), [New Lines for Blocks](#new-lines-for-blocks), [Spaces Around Symbols](#spaces-around-symbols).
78-
* Relevant Behavior Rules: N/A
79-
* Verification Strategy: Run `cargo build -p unilang` to ensure the changes compile.
80-
* Commit Message: "style(unilang): Clean up and document src/parsing.rs"
81-
* ✅ Increment 7: Review `src/registry.rs`
82-
* Detailed Plan Step 1: Read the content of `src/registry.rs`.
83-
* Detailed Plan Step 2: Apply codestyle fixes (spacing, newlines, etc.).
84-
* Detailed Plan Step 3: Add concise documentation to the `CommandRegistry` struct, `CommandRegistryBuilder` struct, and their methods.
85-
* Pre-Analysis: The file contains the command registry. It needs proper documentation and formatting.
86-
* Crucial Design Rules: [Comments and Documentation](#comments-and-documentation)
87-
* Relevant Behavior Rules: N/A
88-
* Verification Strategy: Run `cargo build -p unilang` to ensure the changes compile.
89-
* Commit Message: "style(unilang): Clean up and document src/registry.rs"
90-
* ✅ Increment 8: Review `src/semantic.rs`
91-
* Detailed Plan Step 1: Read the content of `src/semantic.rs`.
92-
* Detailed Plan Step 2: Apply codestyle fixes (spacing, newlines, etc.).
93-
* Detailed Plan Step 3: Add concise documentation to the `VerifiedCommand` and `SemanticAnalyzer` structs and their methods.
94-
* Pre-Analysis: The file contains the semantic analyzer. It needs proper documentation and formatting.
95-
* Crucial Design Rules: [Comments and Documentation](#comments-and-documentation)
96-
* Relevant Behavior Rules: N/A
97-
* Verification Strategy: Run `cargo build -p unilang` to ensure the changes compile.
98-
* Commit Message: "style(unilang): Clean up and document src/semantic.rs"
99-
* ✅ Increment 9: Review `src/ca/` directory
100-
* Detailed Plan Step 1: Read all files in `src/ca/` and its subdirectories.
101-
* Detailed Plan Step 2: Refactor `src/ca/mod.rs`.
102-
* Detailed Plan Step 3: Refactor `src/ca/parsing/mod.rs`.
103-
* Detailed Plan Step 4: Refactor `src/ca/parsing/engine.rs`.
104-
* Detailed Plan Step 5: Refactor `src/ca/parsing/error.rs`.
105-
* Detailed Plan Step 6: Refactor `src/ca/parsing/input.rs`.
106-
* Detailed Plan Step 7: Refactor `src/ca/parsing/instruction.rs`.
107-
* Pre-Analysis: This directory seems to contain a secondary parsing engine or a more complex command architecture (`ca`). It needs to be reviewed for consistency with the rest of the crate.
108-
* Crucial Design Rules: [Comments and Documentation](#comments-and-documentation), [New Lines for Blocks](#new-lines-for-blocks), [Spaces Around Symbols](#spaces-around-symbols).
109-
* Relevant Behavior Rules: N/A
110-
* Verification Strategy: Run `cargo build -p unilang` after refactoring all files in the directory.
111-
* Commit Message: "style(unilang): Clean up and document src/ca/**"
112-
* ✅ Increment 10: Review `tests/` directory
113-
* Detailed Plan Step 1: Read all files in `tests/` and its subdirectories.
114-
* Detailed Plan Step 2: Refactor `tests/tests.rs`.
115-
* Detailed Plan Step 3: Refactor `tests/inc/mod.rs`.
116-
* Detailed Plan Step 4: Refactor `tests/inc/phase1/mod.rs`.
117-
* Detailed Plan Step 5: Refactor `tests/inc/phase1/foundational_setup.rs`.
118-
* Detailed Plan Step 6: Refactor `tests/inc/phase1/full_pipeline_test.rs`.
119-
* Pre-Analysis: The test files need to be reviewed for clarity, documentation, and adherence to codestyle.
120-
* Crucial Design Rules: [Comments and Documentation](#comments-and-documentation)
25+
* ✅ Increment 1: Document `tests/inc/phase1/full_pipeline_test.rs`
26+
* Detailed Plan Step 1: Read the content of `tests/inc/phase1/full_pipeline_test.rs`.
27+
* Detailed Plan Step 2: Add documentation to each test function, linking it to the corresponding Test Matrix rows from the previous plan.
28+
* Pre-Analysis: The integration test file lacks documentation.
29+
* Crucial Design Rules: [Testing: Plan with a Test Matrix When Writing Tests](#testing-plan-with-a-test-matrix-when-writing-tests), [Comments and Documentation](#comments-and-documentation)
12130
* Relevant Behavior Rules: N/A
12231
* Verification Strategy: Run `cargo test -p unilang` to ensure all tests still pass.
123-
* Commit Message: "style(unilang): Clean up and document tests/**"
124-
* ✅ Increment 11: Final Verification
125-
* Detailed Plan Step 1: Run `cargo clippy -- -D warnings` to ensure there are no warnings.
126-
* Detailed Plan Step 2: Run `cargo test` to ensure all tests pass.
127-
* Pre-Analysis: All files have been reviewed. A final check is needed to ensure the entire crate is clean.
128-
* Crucial Design Rules: N/A
129-
* Relevant Behavior Rules: N/A
130-
* Verification Strategy: All checks must pass.
131-
* Commit Message: "chore(unilang): Final verification of codestyle changes"
32+
* Commit Message: "docs(unilang): Add test matrix documentation to integration tests"
13233

13334
### Task Requirements
134-
* Systematically review every `.rs` file.
135-
* Apply codestyle fixes and add documentation as needed.
35+
* Add documentation to test files.
13636

13737
### Project Requirements
13838
* Maintain consistency with the overall workspace codestyle.
13939

14040
### Notes & Insights
141-
* This is a good opportunity to improve the overall quality and maintainability of the crate.
142-
* The `former` crate usage is still disabled and should be noted for future work.
41+
* This will significantly improve the test suite's readability.

module/move/unilang/tests/inc/phase1/full_pipeline_test.rs

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ use unilang::interpreter::{ Interpreter, ExecutionContext };
1111
///
1212
/// Tests for the `Lexer`.
1313
///
14-
// Test Matrix Rows: T1.1, T1.2, T1.3, T1.4
14+
/// This test covers the following combinations from the Test Matrix:
15+
/// - T1.1: A command with various argument types.
16+
/// - T1.2: Multiple commands separated by `;;`.
17+
/// - T1.3: Whitespace handling.
18+
/// - T1.4: Empty string literals.
19+
///
1520
#[test]
1621
fn lexer_tests()
1722
{
@@ -48,7 +53,11 @@ fn lexer_tests()
4853
///
4954
/// Tests for the `Parser`.
5055
///
51-
// Test Matrix Rows: T2.1, T2.2, T2.3
56+
/// This test covers the following combinations from the Test Matrix:
57+
/// - T2.1: A single command with one argument.
58+
/// - T2.2: Multiple commands with arguments.
59+
/// - T2.3: Empty input.
60+
///
5261
#[test]
5362
fn parser_tests()
5463
{
@@ -83,7 +92,13 @@ fn parser_tests()
8392
///
8493
/// Tests for the `SemanticAnalyzer`.
8594
///
86-
// Test Matrix Rows: T3.1, T3.2, T3.3, T3.4, T3.5
95+
/// This test covers the following combinations from the Test Matrix:
96+
/// - T3.1: A valid command with correct arguments.
97+
/// - T3.2: An unknown command.
98+
/// - T3.3: A command with a missing required argument.
99+
/// - T3.4: A command with an argument of the wrong type.
100+
/// - T3.5: A command with too many arguments.
101+
///
87102
#[test]
88103
fn semantic_analyzer_tests()
89104
{
@@ -159,7 +174,10 @@ fn semantic_analyzer_tests()
159174
///
160175
/// Tests for the `Interpreter`.
161176
///
162-
// Test Matrix Rows: T4.1, T4.2
177+
/// This test covers the following combinations from the Test Matrix:
178+
/// - T4.1: A single valid command.
179+
/// - T4.2: Multiple valid commands.
180+
///
163181
#[test]
164182
fn interpreter_tests()
165183
{
@@ -203,7 +221,10 @@ fn interpreter_tests()
203221
///
204222
/// Tests for the `HelpGenerator`.
205223
///
206-
// Test Matrix Rows: T5.1, T5.2
224+
/// This test covers the following combinations from the Test Matrix:
225+
/// - T5.1: A command with arguments.
226+
/// - T5.2: A command without arguments.
227+
///
207228
#[test]
208229
fn help_generator_tests()
209230
{

0 commit comments

Comments
 (0)