Files
xlwings/demo.xlsm
Misaka 2cb22df60c feat: VBA Call Chain Tracking and Full Project Testing System
## Phase 1: Core Call Chain Tracking

### New Features
- CallStack class module: Manually maintain VBA call stack
- Enhanced TestLogger: Integrated call stack management
  - LogEntry: Record on procedure entry
  - LogExit: Pop on procedure exit
  - LogError: Capture complete call chain
- Weave all procedures in module to support call chain tracking

### Data Model Updates
- TestResult new fields: error_module, call_chain
- Result format: ERROR|Module.Proc|Line|Number|Desc|CallChain

### Key Fixes
- Fixed LogSuccess overwriting error state
  LogSuccess now only sets success when no error exists
- Fixed incomplete call chain due to weaving only single procedure
  Now weaves all procedures in the entire module

## Phase 2: Full Project Testing

### New Methods
- CodeWeaver.parse_modules: Parse all VBA modules
- CodeWeaver.weave_module_all_procedures: Weave all procedures in single module
- CodeWeaver.weave_all_modules: Weave all procedures in multiple modules
- TestRunner.discover_all_tests: Auto-discover all entry points
- TestRunner.run_all_tests: Batch execute all tests
- TestRunner._weave_all_modules_inplace: In-place weave all modules

### CLI Interface
- Mode 1: python vba_test_runner.py <file> --all (full project testing)
- Mode 2: python vba_test_runner.py <file> <module> <proc>... (specific testing)

## Test Verification

### Call Chain Tracking Example
TestSuccessfulProcedure -> TestErrorProcedure -> TestTypeMismatch
Output:
  Call Chain: Module1.TestSuccessfulProcedure -> Module1.TestErrorProcedure -> Module1.TestTypeMismatch
  Location: Module1.TestTypeMismatch:20
  Source: y = 20

### Statistics
- New code: ~500 lines
- New methods: 8
- Test scenarios: Multi-level nested call chain verification passed

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-04 22:44:49 +08:00

12 KiB