WIP: Tests for API surface of primitives#3992
WIP: Tests for API surface of primitives#3992rockcoolsaint wants to merge 2 commits intorust-bitcoin:masterfrom
Conversation
Pull Request Test Coverage Report for Build 13082433226Details
💛 - Coveralls |
|
Yes you are on the right track. While reviewing I noticed that it was not trivial to check the imports tested here against the ones done in #[test]
fn api_can_use_all_types_from_module_block() {
{
// New types added in `primitives`.
use bitcoin_primitives::block::{
Block, BlockHash, Checked, Header, Unchecked, Version, WitnessCommitment,
};
}
{
// Re-exports from `units` - `primitives` module layout should mimic `units`.
use bitcoin_primitives::block::{
BlockHeight, BlockInterval, TooBigForRelativeBlockHeightError,
};
}
} |
Is there any reason why the primitives module should mimic the units but not the other way around? |
|
Yes, because |
Modules and data type API surface tests to ensure that the public API of the primitives library remains stable and adheres to best practices
|
Some structs like |
I currently get the following error when I include such structs Or alternatively, is it necessary to implement the |
c8d1e8e to
005f72e
Compare
|
|
cc @Kixunil shouldn't we just put the |
e2d9a8a primitives: Add an API test module (Tobin C. Harding) 8ec2d35 primitives: Derive Clone on witness::Iter (Tobin C. Harding) Pull request description: In preparation for 1.0-ing `primitives` add an `api` test module that makes an effort to verify the API surface. This is similar to what is in `units` and what is in development for `hashes` (in #4017). Note, there is a WIP attempt at this in #3992. Close: #3928 ACKs for top commit: apoelstra: ACK e2d9a8a; successfully ran local tests Tree-SHA512: 5ec5c87c9aa5e86e579283a5485dcb2b3b5ae59359ae5ab96f8e6634285072bef0d0f111b6780852fd88fe29677f1a84c791a3343a0cb2b09093e77125f3962b
Please help review if the following changes are inline with the objectives of this issue
Resolves #3928