Skip to main content

test_table

Macro test_table 

Source
macro_rules! test_table {
    (@replace_expr $_t:tt $sub:expr) => { ... };
    (@count_tts $($smth:tt)*) => { ... };
    [[$($col:expr),+ $(,)?]; $([$($val:expr),+ $(,)?]),+ $(,)?] => { ... };
}
Expand description

Helper for constructing table (list of records) values for use in tests and Examples

let test = test_table![
    ["a", "b", "c"];
    [1, 2, 3],
    [4, 5, 6],
];

let expected = Value::test_list(vec![
    test_record! {"a" => 1, "b" => 2, "c" => 3},
    test_record! {"a" => 4, "b" => 5, "c" => 6},
]);

assert_eq!(test, expected);