Skip to content
This repository has been archived by the owner on May 4, 2024. It is now read-only.

[Feature Request] Doctest #1044

Open
alnoki opened this issue Apr 26, 2023 · 0 comments
Open

[Feature Request] Doctest #1044

alnoki opened this issue Apr 26, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@alnoki
Copy link
Contributor

alnoki commented Apr 26, 2023

@davidiw @sblackshear @wrwg

Ideally running move unit tests would also run doctests inside any doc comments in the package.

For comparison, consider the following from BCS:

//! ```rust
//! # use bcs::{Result, to_bytes};
//! # fn main() -> Result<()> {
//! let fixed: [u16; 3] = [1, 2, 3];
//! assert_eq!(to_bytes(&fixed)?, vec![1, 0, 2, 0, 3, 0]);
//!
//! let variable: Vec<u16> = vec![1, 2];
//! assert_eq!(to_bytes(&variable)?, vec![2, 1, 0, 2, 0]);
//!
//! let large_variable_length: Vec<()> = vec![(); 9_487];
//! assert_eq!(to_bytes(&large_variable_length)?, vec![0x8f, 0x4a]);
//! # Ok(())}
//! ```

See also:

@alnoki alnoki added the enhancement New feature or request label Apr 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant