Summary
Improve test coverage from 85.18% to 90%+ by adding edge case tests for Parser, Validator, and Context modules. This ensures better confidence in error paths and edge case handling.
Context
Architecture reference: docs/architecture.md - Error Messages for LLM Consumption
Dependencies: None
Related issues: None
Current State
Verified via mix test --cover:
- Overall coverage: 85.18% (target: 90%)
- Parser: 66.67% - Missing edge case tests for malformed input
- Validator: 80.22% - Some validation paths untested
- Context: 66.67% - Simple module, some paths untested
Other modules are well-covered:
- PtcRunner: 100%
- Schema: 94.12%
- Sandbox: 87.50%
- Interpreter: 84.62%
- Operations: ~90%
Acceptance Criteria
Implementation Hints
Files to modify:
test/ptc_runner/parser_test.exs - Add edge case tests (create if needed)
test/ptc_runner/validator_test.exs - Add validation path tests (create if needed)
test/ptc_runner/context_test.exs - Add context edge cases (create if needed)
Parser edge cases to test:
- Non-string, non-map input (integer, list, nil)
- Empty string input
- Valid JSON but not a valid program structure
- JSON with unexpected top-level keys
Validator edge cases to test:
- Unknown operation with no close match (no typo suggestion)
- Nested validation errors (error in nested expression)
- Field type mismatches for each field type
- Missing required fields for each operation type
- Extra unexpected fields in operations
Context edge cases to test:
- Get non-existent variable
- Put and get with special characters in name
- Tools map edge cases
Patterns to follow:
- Existing tests in
test/ptc_runner_test.exs for assertion style
- Use descriptive test names that explain the scenario
- Group related tests in describe blocks
Test Plan
Unit tests (the deliverable):
- Parser: 5-8 new edge case tests
- Validator: 8-12 new validation path tests
- Context: 3-5 new edge case tests
Verification:
- Run
mix test --cover and verify 90%+ coverage
- Ensure no test is trivial (each should catch a real potential bug)
Out of Scope
- Refactoring existing tests
- Adding tests for well-covered modules (Operations, Schema)
- Performance testing
- Integration or E2E tests
Notes from Review
- Parser has no nesting limit, so "deeply nested JSON at max depth boundary" is not applicable
- Some Validator type paths are dead code (custom validators bypass generic validation), but testing them is still valuable for completeness
- Context
new/2 default argument "miss" is an Elixir coverage quirk, not a real missed path
Summary
Improve test coverage from 85.18% to 90%+ by adding edge case tests for Parser, Validator, and Context modules. This ensures better confidence in error paths and edge case handling.
Context
Architecture reference: docs/architecture.md - Error Messages for LLM Consumption
Dependencies: None
Related issues: None
Current State
Verified via
mix test --cover:Other modules are well-covered:
Acceptance Criteria
Implementation Hints
Files to modify:
test/ptc_runner/parser_test.exs- Add edge case tests (create if needed)test/ptc_runner/validator_test.exs- Add validation path tests (create if needed)test/ptc_runner/context_test.exs- Add context edge cases (create if needed)Parser edge cases to test:
Validator edge cases to test:
Context edge cases to test:
Patterns to follow:
test/ptc_runner_test.exsfor assertion styleTest Plan
Unit tests (the deliverable):
Verification:
mix test --coverand verify 90%+ coverageOut of Scope
Notes from Review
new/2default argument "miss" is an Elixir coverage quirk, not a real missed path