on master help sign in
Move tabs_* snapshot tests to integration_tests
afc5aacLawrence Chou
tests/integration_tests.rs+37
@@ -1,7 +1,10 @@
1extern crate assert_cmd;
1extern crate assert_cmd;
2
2
3+mod tester;
4+
3use assert_cmd::prelude::*;
5use assert_cmd::prelude::*;
4use std::process::Command;
6use std::process::Command;
7+use tester::BatTester;
5
8
6fn bat() -> Command {
9fn bat() -> Command {
7 let mut cmd = Command::main_binary().unwrap();
10 let mut cmd = Command::main_binary().unwrap();
@@ -12,6 +15,10 @@ fn bat() -> Command {
12 cmd
15 cmd
13}
16}
14
17
18+fn tester() -> BatTester {
19+ BatTester::new()
20+}
21+
15#[test]
22#[test]
16fn basic() {
23fn basic() {
17 bat()
24 bat()
@@ -96,6 +103,36 @@ fn line_range_last_3() {
96 .stdout("line 2\nline 3\nline 4\n");
103 .stdout("line 2\nline 3\nline 4\n");
97}
104}
98
105
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+
99#[test]
136#[test]
100fn fail_non_existing() {
137fn fail_non_existing() {
101 bat().arg("non-existing-file").assert().failure();
138 bat().arg("non-existing-file").assert().failure();
tests/snapshot_tests.rs−6
@@ -32,10 +32,4 @@ snapshot_tests! {
32 changes_grid_header_numbers: "changes,grid,header,numbers" => [wrap: false, tabs: 8],
32 changes_grid_header_numbers: "changes,grid,header,numbers" => [wrap: false, tabs: 8],
33 full: "full" => [wrap: false, tabs: 8],
33 full: "full" => [wrap: false, tabs: 8],
34 plain: "plain" => [wrap: false, tabs: 0],
34 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],
41}
35}