Split snapshot tests into individual tests

This commit is contained in:
sharkdp 2018-08-31 22:24:36 +02:00 committed by David Peter
parent 0a5b3eaf3e
commit 0b1535f63b

View File

@ -2,32 +2,34 @@ mod tester;
use tester::BatTester; use tester::BatTester;
static STYLES: &'static [&'static str] = &[ macro_rules! snapshot_tests {
"changes", ($($test_name: ident: $style: expr,)*) => {
"grid", $(
"header", #[test]
"numbers", fn $test_name() {
"changes,grid", let bat_tester = BatTester::new();
"changes,header", bat_tester.test_snapshot($style);
"changes,numbers", }
"grid,header", )*
"grid,numbers", };
"header,numbers", }
"changes,grid,header",
"changes,grid,numbers", snapshot_tests! {
"changes,header,numbers", changes: "changes",
"grid,header,numbers", grid: "grid",
"changes,grid,header,numbers", header: "header",
"full", numbers: "numbers",
"plain", changes_grid: "changes,grid",
]; changes_header: "changes,header",
changes_numbers: "changes,numbers",
#[test] grid_header: "grid,header",
fn test_snapshots() { grid_numbers: "grid,numbers",
let bat_tester = BatTester::new(); header_numbers: "header,numbers",
changes_grid_header: "changes,grid,header",
for style in STYLES { changes_grid_numbers: "changes,grid,numbers",
println!("testing {}", style); changes_header_numbers: "changes,header,numbers",
bat_tester.test_snapshot(&*style); grid_header_numbers: "grid,header,numbers",
} changes_grid_header_numbers: "changes,grid,header,numbers",
full: "full",
plain: "plain",
} }