2
0
mirror of https://github.com/sharkdp/bat synced 2024-11-16 21:25:56 +00:00

Move tabs_* snapshot tests to integration_tests

This commit is contained in:
Lawrence Chou 2018-10-14 22:22:59 +08:00 committed by David Peter
parent 30b742e984
commit afc5aacb28
2 changed files with 37 additions and 6 deletions

View File

@ -1,7 +1,10 @@
extern crate assert_cmd; extern crate assert_cmd;
mod tester;
use assert_cmd::prelude::*; use assert_cmd::prelude::*;
use std::process::Command; use std::process::Command;
use tester::BatTester;
fn bat() -> Command { fn bat() -> Command {
let mut cmd = Command::main_binary().unwrap(); let mut cmd = Command::main_binary().unwrap();
@ -12,6 +15,10 @@ fn bat() -> Command {
cmd cmd
} }
fn tester() -> BatTester {
BatTester::new()
}
#[test] #[test]
fn basic() { fn basic() {
bat() bat()
@ -96,6 +103,36 @@ fn line_range_last_3() {
.stdout("line 2\nline 3\nline 4\n"); .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] #[test]
fn fail_non_existing() { fn fail_non_existing() {
bat().arg("non-existing-file").assert().failure(); bat().arg("non-existing-file").assert().failure();

View File

@ -32,10 +32,4 @@ snapshot_tests! {
changes_grid_header_numbers: "changes,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], full: "full" => [wrap: false, tabs: 8],
plain: "plain" => [wrap: false, tabs: 0], 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],
} }