macro_rules! test_file_test {
    ($suite:ident, $base_dir:expr, { $($test_name:ident : $test_file:expr),* $(,)? }, $test_func:ident) => { ... };
}
Expand description

Creates a test that reads test files for a given function. test_name - the name of the test. filenames - a vector of tests files the test applies to. func - the function to be applied on the test params to generate the tested result.

The signature of func should be of the form:

fn func(
    inputs: &OrderedHashMap<String, String>
) -> OrderedHashMap<String, String>;

And func can read the tags from the file from the input map. It should return the expected outputs with the same tags as the file, in the output map.

The structure of the file must be of the following form:

//! > test description

//! > test_runner_name
test_to_upper

//! > input1
hello

//! > input2
world

//! > expected_output1
HELLO

//! > expected_output2
WORLD

//! > ==========================================================================

<another test>

The call to the macro looks like:

test_file_test!(
    test_suite_name,
    "path/to/test/dir",
    {
        test_name1: "test_file1",
        test_name2: "test_file2",
    },
    test_to_upper
);