file in cargo_test_support - Rust
Description: Declare an expected value for an assert from a file

Skip to main content

## file

# Macro file

    macro_rules! file {
        (_) => { ... };
        (_ : $type:ident) => { ... };
        ($path:literal) => { ... };
        ($path:literal : $type:ident) => { ... };
    }

Expand description

Declare an expected value for an assert from a file

This is relative to the source file the macro is run from

Output type: `Data`

    file!["./test_data/bar.json"];
    file!["./test_data/bar.json": Text];  // do textual rather than structural comparisons
    file![_];
    file![_: Json];  // ensure its treated as json since a type can't be inferred