Skip to content

Conversation

@RAprogramm
Copy link
Owner

Summary

Comprehensive test coverage for src/turnkey/domain.rs to achieve 95%+ coverage target.

Coverage Improvement

Before: 88.24% lines
After: 98.29% lines
Delta: +10.05%

Tests Added

TurnkeyError::new tests

  • Different message types: String, &str, empty, long (1000 chars), unicode
  • Kind preservation
  • Message preservation

TurnkeyError Display tests

  • Formatted output with message
  • Formatted output with empty message

TurnkeyError trait tests

  • Clone creates identical copy
  • PartialEq compares kind and message correctly

TurnkeyErrorKind tests

  • Clone works (Copy trait)
  • PartialEq compares variants
  • Display output for all 6 variants

map_turnkey_kind tests

  • All 6 kind mappings verified
  • Correct AppErrorKind returned for each variant

Test Coverage

  • ✓ All error construction paths tested
  • ✓ Edge cases covered (empty, long, unicode messages)
  • ✓ Display trait implementation verified
  • ✓ Clone and PartialEq behavior validated
  • ✓ All kind mappings tested

Verification

cargo test --lib turnkey::domain
cargo llvm-cov --all-features --workspace

Closes #237

Added complete test coverage for src/turnkey/domain.rs:

- Added 17 unit tests for TurnkeyErrorKind and TurnkeyError
- Added 10 doctests for all public types and methods
- Added module-level documentation
- Tested Display implementations for both enum and struct
- Tested Clone, PartialEq, Eq traits
- Tested TurnkeyError::new with various input types
- Verified map_turnkey_kind mappings

Test results:
- Unit tests: 386 passed (was 367, +19)
- Doctests: 10 for turnkey::domain module
- Clippy: no warnings
- Formatting: compliant with rustfmt

Coverage:
- TurnkeyErrorKind: 100%
- TurnkeyError: 100%
- map_turnkey_kind: 100%
- Test TurnkeyError::new with different message types (string, str, empty, long, unicode)
- Test TurnkeyError Display trait
- Test TurnkeyError Clone and PartialEq
- Test TurnkeyErrorKind Display for all variants
- Test TurnkeyErrorKind Clone and PartialEq
- Test map_turnkey_kind for all variants
- Coverage: 88.24% -> 98.29%
@codecov
Copy link

codecov bot commented Oct 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@RAprogramm RAprogramm merged commit c30da5e into main Oct 24, 2025
19 checks passed
@RAprogramm RAprogramm deleted the 237 branch October 24, 2025 01:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

src/turnkey/domain.rs

2 participants