From afc5aacb28563bbe0019a922d536660a14279da6 Mon Sep 17 00:00:00 2001 From: Lawrence Chou Date: Sun, 14 Oct 2018 22:22:59 +0800 Subject: [PATCH] Move tabs_* snapshot tests to integration_tests --- tests/integration_tests.rs | 37 +++++++++++++++++++++++++++++++++++++ tests/snapshot_tests.rs | 6 ------ 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index 23acf3fc..c1af27fc 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -1,7 +1,10 @@ extern crate assert_cmd; +mod tester; + use assert_cmd::prelude::*; use std::process::Command; +use tester::BatTester; fn bat() -> Command { let mut cmd = Command::main_binary().unwrap(); @@ -12,6 +15,10 @@ fn bat() -> Command { cmd } +fn tester() -> BatTester { + BatTester::new() +} + #[test] fn basic() { bat() @@ -96,6 +103,36 @@ fn line_range_last_3() { .stdout("line 2\nline 3\nline 4\n"); } +#[test] +fn tabs_passthrough_wrapped() { + tester().test_snapshot("tabs_passthrough_wrapped", "full", 0, true); +} + +#[test] +fn tabs_4_wrapped() { + tester().test_snapshot("tabs_4_wrapped", "full", 4, true); +} + +#[test] +fn tabs_8_wrapped() { + tester().test_snapshot("tabs_8_wrapped", "full", 8, true); +} + +#[test] +fn tabs_passthrough() { + tester().test_snapshot("tabs_passthrough", "full", 0, false); +} + +#[test] +fn tabs_4() { + tester().test_snapshot("tabs_4", "full", 4, false); +} + +#[test] +fn tabs_8() { + tester().test_snapshot("tabs_8", "full", 8, false); +} + #[test] fn fail_non_existing() { bat().arg("non-existing-file").assert().failure(); diff --git a/tests/snapshot_tests.rs b/tests/snapshot_tests.rs index 6e76c8b5..609f19c5 100644 --- a/tests/snapshot_tests.rs +++ b/tests/snapshot_tests.rs @@ -32,10 +32,4 @@ snapshot_tests! { 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], }