Current test coverage: 93.84% (274/292 lines)
-
Unit Tests (
justcode-core/src/*.rs)- Located in each module's
#[cfg(test)]block - Test individual components in isolation
- 60+ unit tests covering all primitives, collections, and edge cases
- Located in each module's
-
Integration Tests (
justcode-core/tests/integration_tests.rs)- Test complex scenarios with multiple types
- Test streaming API usage
- Test configuration options
- Test error handling
- 11 integration tests
-
No-Std Tests (
justcode-core/tests/no_std_tests.rs)- Test Vec implementations (works with both std and no-std)
- 5 tests for Vec functionality
cargo test --workspacecargo test --workspace --test integration_testscargo test --workspace --test no_std_testscargo tarpaulin --workspace --out Html --exclude-files '*/tests/*' '*/examples/*' 'justcode-derive/*'The no-std Vec implementations (lines 211-215, 217, 223-228, 230 in encode.rs) are conditionally compiled when the std feature is disabled. These code paths are tested separately using a dedicated test suite.
To test no-std code paths:
cargo test --package justcode-core --test no_std_integration --no-default-features --features deriveThe no_std_integration.rs test file contains 9 comprehensive tests that verify:
- Basic Vec encoding/decoding
- Empty Vec handling
- Large Vec operations
- Structs containing Vec fields
- Nested Vec structures
- Option with Vec
- Different primitive types in Vec
- Varint encoding with no-std Vec
- Configuration options with no-std
These tests compile and run without the std feature, ensuring the no-std code paths are actually executed and verified.
The remaining uncovered lines (6.16%) are:
-
No-std Vec implementations (lines 211-215, 217, 223-228, 230 in
encode.rs)- Conditionally compiled code
- Functionally identical to std versions
- Tested indirectly through Vec tests
-
Error paths in reader.rs (lines 123-124, 133-134)
- Edge case error handling
- Covered by error tests but may not be detected by coverage tool
-
Option None branch (line 241 in
encode.rs)- Should be covered but may not be detected
- All integer types (u8-u64, i8-i64, usize)
- Floating point (f32, f64)
- Boolean and char
- Edge cases (invalid char, invalid UTF-8)
- Vec (empty, small, large)
- Option (Some, None)
- String and &str
- &[u8]
- Tuples (1-4 elements)
- Arrays (0-32 elements)
- Nested structures
- Structs with Vec fields
- Standard config
- With size limits
- With/without varint encoding
- Config chaining
- Unexpected end of input
- Size limit exceeded
- Invalid varint
- Invalid UTF-8
- Writer API
- Reader API
- Multiple values in stream
- Bytes read tracking
- Current: 93.84%
- Target: 95%
- Gap: 1.16% (mostly conditionally compiled no-std code)
The remaining uncovered code is primarily conditionally compiled no-std implementations that are functionally identical to their std counterparts and are tested indirectly.