Crate fn_fixture[][src]

This crate provides a procedural macro to set up tests based on a directory of inputs to a function.

A more complete explanation is provided in the readme of the repository.


The annotation has 3 primary requirements:

  • It must be annotating a function with return type implementing std::fmt::Debug. Result is weakly recommended.

  • It must use a string literal containing the path (relative to cargo manifest) to a base folder. A base folder must contain test folders or base folders. Test folders must contain exactly one of, input.txt, or input.bin.

  • It must have a single parameter of the corresponding to a respective type of the input files as included by their respective macros, include, include_str, and include_bytes.



fn parse_unsigned_number(value: &str) -> Result<usize, impl std::fmt::Debug> {



Notice that snapshot-tests/examples does not itself contain an input.txt

Attribute Macros


Denotes the entrance point of a function-fixture's snapshots.