2
0
mirror of https://github.com/sharkdp/bat synced 2024-11-08 19:10:41 +00:00
bat/tests/tests.rs
eth-p 9159341714
Modified snapshot tests to support tab expansion.
This changes how the files are named (to allow for snapshots that aren't
directly related to the --style argument) and fixes the
generate_snapshots.py script to work with the latest version of bat.

Three new tests are also introduced:
- tabs_4 - Tab expansion with a width of 4.
- tabs_8 - Tab expansion with a width of 8.
- tabs_passthrough - No tab expansion.
2018-09-10 19:19:43 -07:00

39 lines
1.3 KiB
Rust

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