on master help sign in
Move tabs_* snapshot tests to integration_tests
commitafc5aacb28563bbe0019a922d536660a14279da6 authorLawrence Chou <lawrencechou1024@gmail.com> dateSun 14 Oct 2018, 22:22 (8 years ago) parent30b742e
2 files changed+37−6
tests/integration_tests.rs+37 tests/snapshot_tests.rs−6
tests/integration_tests.rs+37
@@ -1,7 +1,10 @@
11extern crate assert_cmd;
22
3+mod tester;
4+
35use assert_cmd::prelude::*;
46use std::process::Command;
7+use tester::BatTester;
58
69fn bat() -> Command {
710 let mut cmd = Command::main_binary().unwrap();
@@ -12,6 +15,10 @@ fn bat() -> Command {
1215 cmd
1316}
1417
18+fn tester() -> BatTester {
19+ BatTester::new()
20+}
21+
1522#[test]
1623fn basic() {
1724 bat()
@@ -96,6 +103,36 @@ fn line_range_last_3() {
96103 .stdout("line 2\nline 3\nline 4\n");
97104}
98105
106+#[test]
107+fn tabs_passthrough_wrapped() {
108+ tester().test_snapshot("tabs_passthrough_wrapped", "full", 0, true);
109+}
110+
111+#[test]
112+fn tabs_4_wrapped() {
113+ tester().test_snapshot("tabs_4_wrapped", "full", 4, true);
114+}
115+
116+#[test]
117+fn tabs_8_wrapped() {
118+ tester().test_snapshot("tabs_8_wrapped", "full", 8, true);
119+}
120+
121+#[test]
122+fn tabs_passthrough() {
123+ tester().test_snapshot("tabs_passthrough", "full", 0, false);
124+}
125+
126+#[test]
127+fn tabs_4() {
128+ tester().test_snapshot("tabs_4", "full", 4, false);
129+}
130+
131+#[test]
132+fn tabs_8() {
133+ tester().test_snapshot("tabs_8", "full", 8, false);
134+}
135+
99136#[test]
100137fn fail_non_existing() {
101138 bat().arg("non-existing-file").assert().failure();
tests/snapshot_tests.rs−6
@@ -32,10 +32,4 @@ snapshot_tests! {
3232 changes_grid_header_numbers: "changes,grid,header,numbers" => [wrap: false, tabs: 8],
3333 full: "full" => [wrap: false, tabs: 8],
3434 plain: "plain" => [wrap: false, tabs: 0],
35− tabs_passthrough_wrapped: "full" => [wrap: true, tabs: 0],
36− tabs_4_wrapped: "full" => [wrap: true, tabs: 4],
37− tabs_8_wrapped: "full" => [wrap: true, tabs: 8],
38− tabs_passthrough: "full" => [wrap: false, tabs: 0],
39− tabs_4: "full" => [wrap: false, tabs: 4],
40− tabs_8: "full" => [wrap: false, tabs: 8],
4135}