Skip to content

Please add tests for the no_std variant #2

Open
@dkg

Description

@dkg

Looks like the mod tests sections in src/{encode,decode}_impl.rs both test the high-level interface, which requires std

that means that a test without the std feature will fail:

0 dkg@hos:…/libzbase32$ cargo --offline test --all-targets --no-default-features 
   Compiling libzbase32 v2.0.1 (…/libzbase32)
error[E0432]: unresolved import `super::decode`
   --> src/decode_impl.rs:264:9
    |
264 |     use super::decode;
    |         ^^^^^^^^^^^^^ no `decode` in `decode_impl`

error[E0432]: unresolved import `super::encode`
   --> src/encode_impl.rs:253:9
    |
253 |     use super::encode;
    |         ^^^^^^^^^^^^^ no `encode` in `encode_impl`

error[E0433]: failed to resolve: use of undeclared type `Vec`
   --> src/decode_impl.rs:268:26
    |
268 |         let mut buffer = Vec::new();
    |                          ^^^ use of undeclared type `Vec`

error[E0433]: failed to resolve: use of undeclared type `String`
   --> src/encode_impl.rs:257:26
    |
257 |         let mut buffer = String::new();
    |                          ^^^^^^ use of undeclared type `String`

Some errors have detailed explanations: E0432, E0433.
For more information about an error, try `rustc --explain E0432`.
error: could not compile `libzbase32` due to 4 previous errors
101 dkg@host:…/libzbase32$ 

If i decorate the two mod tests sections with #[cfg(feature = "std")] then i get a handful of warnings about unused items in src/test_data.rs -- and no tests run at all ☹

Seems like the right thing to do is to add tests for the low level api.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions