1extern crate assert_cmd;
4extern crate lazy_static;
6use assert_cmd::prelude::*;
8use std::process::Command;
11 static ref CARGO_RUN: CargoRun = escargot::CargoBuild::new()
18fn bat_with_config() -> Command {
19 let mut cmd = CARGO_RUN.command();
20 cmd.current_dir("tests/examples");
21 cmd.env_remove("PAGER");
22 cmd.env_remove("BAT_PAGER");
23 cmd.env_remove("BAT_CONFIG_PATH");
24 cmd.env_remove("BAT_STYLE");
25 cmd.env_remove("BAT_THEME");
26 cmd.env_remove("BAT_TABS");
31 let mut cmd = bat_with_config();
32 cmd.arg("--no-config");
42 .stdout("hello world\n")
53 .stdout("foo\nbar\n");
63 .stdout("hello world\nhello world\n");
67fn concatenate_stdin() {
76 .stdout("hello world\nstdin\nhello world\n");
83 .arg("--style=numbers")
84 .arg("--decorations=always")
87 .stdout(" 1 line 1\n 2 line 2\n 3 line 3\n 4 line 4\n");
94 .arg("--line-range=2:3")
97 .stdout("line 2\nline 3\n");
101fn line_range_first_two() {
103 .arg("multiline.txt")
104 .arg("--line-range=:2")
107 .stdout("line 1\nline 2\n");
111fn line_range_last_3() {
113 .arg("multiline.txt")
114 .arg("--line-range=2:")
117 .stdout("line 2\nline 3\nline 4\n");
121fn line_range_multiple() {
123 .arg("multiline.txt")
124 .arg("--line-range=1:2")
125 .arg("--line-range=4:4")
128 .stdout("line 1\nline 2\nline 4\n");
136 .arg("--style=numbers")
137 .arg("--decorations=always")
155fn tabs_passthrough_wrapped() {
159 .arg("--style=plain")
160 .arg("--decorations=always")
182 .arg("--style=plain")
183 .arg("--decorations=always")
205 .arg("--style=plain")
206 .arg("--decorations=always")
224fn tabs_passthrough() {
228 .arg("--style=plain")
229 .arg("--decorations=always")
251 .arg("--style=plain")
252 .arg("--decorations=always")
274 .arg("--style=plain")
275 .arg("--decorations=always")
293fn fail_non_existing() {
294 bat().arg("non-existing-file").assert().failure();
299 bat().arg("sub_directory").assert().failure();
303fn do_not_exit_directory() {
305 .arg("sub_directory")
308 .stdout("hello world\n")
315 .env("PAGER", "echo pager-output")
316 .arg("--paging=always")
320 .stdout("pager-output\n");
324fn pager_overwrite() {
326 .env("PAGER", "echo other-pager")
327 .env("BAT_PAGER", "echo pager-output")
328 .arg("--paging=always")
332 .stdout("pager-output\n");
338 .env("PAGER", "echo other-pager")
339 .env("BAT_PAGER", "")
340 .arg("--paging=always")
344 .stdout("hello world\n");
348fn config_location_test() {
350 .env("BAT_CONFIG_PATH", "bat.conf")
351 .arg("--config-file")
354 .stdout("bat.conf\n");
358fn config_read_arguments_from_file() {
360 .env("BAT_CONFIG_PATH", "bat.conf")
364 .stdout("dummy-pager-from-config\n");
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list