Move snapshot tests into separate module

This commit is contained in:
sharkdp 2018-10-07 12:20:48 +02:00 committed by David Peter
parent 6d1cc8c2c8
commit e09d7dabb8

View file

@ -1,41 +1,43 @@
mod tester;
use tester::BatTester;
mod snapshot {
use tester::BatTester;
macro_rules! snapshot_tests {
($($test_name: ident: $style: expr => [wrap: $wrap:expr, tabs: $tabs:expr],)*) => {
$(
#[test]
fn $test_name() {
let bat_tester = BatTester::new();
bat_tester.test_snapshot(stringify!($test_name), $style, $tabs, $wrap);
}
)*
};
}
macro_rules! snapshot_tests {
($($test_name: ident: $style: expr => [wrap: $wrap:expr, tabs: $tabs:expr],)*) => {
$(
#[test]
fn $test_name() {
let bat_tester = BatTester::new();
bat_tester.test_snapshot(stringify!($test_name), $style, $tabs, $wrap);
}
)*
};
}
snapshot_tests! {
changes: "changes" => [wrap: false, tabs: 8],
grid: "grid" => [wrap: false, tabs: 8],
header: "header" => [wrap: false, tabs: 8],
numbers: "numbers" => [wrap: false, tabs: 8],
changes_grid: "changes,grid" => [wrap: false, tabs: 8],
changes_header: "changes,header" => [wrap: false, tabs: 8],
changes_numbers: "changes,numbers" => [wrap: false, tabs: 8],
grid_header: "grid,header" => [wrap: false, tabs: 8],
grid_numbers: "grid,numbers" => [wrap: false, tabs: 8],
header_numbers: "header,numbers" => [wrap: false, tabs: 8],
changes_grid_header: "changes,grid,header" => [wrap: false, tabs: 8],
changes_grid_numbers: "changes,grid,numbers" => [wrap: false, tabs: 8],
changes_header_numbers: "changes,header,numbers" => [wrap: false, tabs: 8],
grid_header_numbers: "grid,header,numbers" => [wrap: false, tabs: 8],
changes_grid_header_numbers: "changes,grid,header,numbers" => [wrap: false, tabs: 8],
full: "full" => [wrap: false, tabs: 8],
plain: "plain" => [wrap: false, tabs: 0],
tabs_passthrough_wrapped: "full" => [wrap: true, tabs: 0],
tabs_4_wrapped: "full" => [wrap: true, tabs: 4],
tabs_8_wrapped: "full" => [wrap: true, tabs: 8],
tabs_passthrough: "full" => [wrap: false, tabs: 0],
tabs_4: "full" => [wrap: false, tabs: 4],
tabs_8: "full" => [wrap: false, tabs: 8],
snapshot_tests! {
changes: "changes" => [wrap: false, tabs: 8],
grid: "grid" => [wrap: false, tabs: 8],
header: "header" => [wrap: false, tabs: 8],
numbers: "numbers" => [wrap: false, tabs: 8],
changes_grid: "changes,grid" => [wrap: false, tabs: 8],
changes_header: "changes,header" => [wrap: false, tabs: 8],
changes_numbers: "changes,numbers" => [wrap: false, tabs: 8],
grid_header: "grid,header" => [wrap: false, tabs: 8],
grid_numbers: "grid,numbers" => [wrap: false, tabs: 8],
header_numbers: "header,numbers" => [wrap: false, tabs: 8],
changes_grid_header: "changes,grid,header" => [wrap: false, tabs: 8],
changes_grid_numbers: "changes,grid,numbers" => [wrap: false, tabs: 8],
changes_header_numbers: "changes,header,numbers" => [wrap: false, tabs: 8],
grid_header_numbers: "grid,header,numbers" => [wrap: false, tabs: 8],
changes_grid_header_numbers: "changes,grid,header,numbers" => [wrap: false, tabs: 8],
full: "full" => [wrap: false, tabs: 8],
plain: "plain" => [wrap: false, tabs: 0],
tabs_passthrough_wrapped: "full" => [wrap: true, tabs: 0],
tabs_4_wrapped: "full" => [wrap: true, tabs: 4],
tabs_8_wrapped: "full" => [wrap: true, tabs: 8],
tabs_passthrough: "full" => [wrap: false, tabs: 0],
tabs_4: "full" => [wrap: false, tabs: 4],
tabs_8: "full" => [wrap: false, tabs: 8],
}
}