Tools for writing and running tests.
This crate serves as an aggregation layer that unifies testing tools from multiple ecosystem crates:
error_tools- Error handling and assertionscollection_tools- Collection constructor macros and utilitiesimpls_index- Implementation and test organization macrosmem_tools,typing_tools,diagnostics_tools- Specialized testing utilities
Namespace Re-exports: The crate provides unified access through own::*, orphan::*, exposed::*, and prelude::* modules that re-export functionality from dependency crates.
Macro Re-exports: Collection constructor macros (heap!, vec!, etc.) require explicit re-export since #[macro_export] macros are not propagated through module re-exports.
Feature Cascading: Features are propagated to dependencies through Cargo.toml, with some requiring explicit handling in source code.
Tests from dependency crates are included via path references to ensure re-export consistency. This requires the complete public API to remain visible during test compilation.
Use test.sh to run tests across all aggregated crates since changes in one can affect others:
# From module/core directory:
./test.sh # Run all tests for test_tools + aggregated subcrates
./test.sh quick # Quick compilation check onlyWhat it tests:
error_tools- Error handling and debug assertions (18 tests + 13 doc tests)collection_tools- Collection types and constructor macros (35 tests + 60 doc tests)mem_tools- Memory comparison utilities (7 tests + 0 doc tests)diagnostics_tools- Runtime/compile-time assertions (4 tests + 8 doc tests)impls_index- Implementation indexing and test organization (30 tests + 0 doc tests)test_tools- Aggregated test suite (192 tests + 5 doc tests)
Total Coverage: 372 comprehensive tests across all 6 crates (286 unit/integration + 86 documentation tests)
✅ Status: All 6 crates pass comprehensive testing with zero warnings (nextest + doc tests + clippy analysis)
Why cross-crate testing is needed:
- Changes in
test_tools/src/standalone.rscan break individual crate tests - Changes in individual crates can break
test_toolsaggregation - Macro changes affect all subcrates using
tests_impls!andtests_index! - Module structure changes can break
the_modulealias resolution
Architecture: Individual crates use the_module alias pattern that switches between crate_name (individual testing) and test_tools (aggregated testing), enabling the same test source code to work in both contexts.
📖 For comprehensive documentation: See CROSS_CRATE_TESTING.md for detailed architecture, troubleshooting, and implementation guidance.
For test compilation issues, see the comprehensive troubleshooting documentation embedded in the source code:
- Main troubleshooting guide: See doc comments at the top of
src/lib.rs - Test-specific guidance: See doc comments in
tests/tests.rsandtests/inc/mod.rs - Inline warnings: Critical sections have detailed prevention and resolution guidance
- Historical context: Each warning references the specific task that resolved the issue
use test_tools::*;
#[ cfg( feature = "enabled" ) ]
#[ cfg( not( feature = "no_std" ) ) ]
tests_impls!
{
fn pass1()
{
assert_eq!( true, true );
}
//
fn pass2()
{
assert_eq!( 1, 1 );
}
}
//
#[ cfg( feature = "enabled" ) ]
#[ cfg( not( feature = "no_std" ) ) ]
tests_index!
{
pass1,
pass2,
}cargo add test_tools --devgit clone https://github.com/Wandalen/wTools
cd wTools
cd examples/test_trivial
cargo run