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");
80fn concatenate_empty_first() {
86 .stdout("hello world\n");
90fn concatenate_empty_last() {
96 .stdout("hello world\n");
100fn concatenate_empty_both() {
110fn concatenate_empty_between() {
117 .stdout("hello world\nhello world\n");
121fn concatenate_empty_first_and_last() {
128 .stdout("hello world\n");
132fn concatenate_single_line() {
134 .arg("single-line.txt")
135 .arg("single-line.txt")
138 .stdout("Single LineSingle Line");
142fn concatenate_single_line_empty() {
144 .arg("single-line.txt")
146 .arg("single-line.txt")
149 .stdout("Single LineSingle Line");
155 .arg("multiline.txt")
156 .arg("--style=numbers")
157 .arg("--decorations=always")
160 .stdout(" 1 line 1\n 2 line 2\n 3 line 3\n 4 line 4\n");
166 .arg("multiline.txt")
167 .arg("--line-range=2:3")
170 .stdout("line 2\nline 3\n");
174fn line_range_first_two() {
176 .arg("multiline.txt")
177 .arg("--line-range=:2")
180 .stdout("line 1\nline 2\n");
184fn line_range_last_3() {
186 .arg("multiline.txt")
187 .arg("--line-range=2:")
190 .stdout("line 2\nline 3\nline 4\n");
194fn line_range_multiple() {
196 .arg("multiline.txt")
197 .arg("--line-range=1:2")
198 .arg("--line-range=4:4")
201 .stdout("line 1\nline 2\nline 4\n");
209 .arg("--style=numbers")
210 .arg("--decorations=always")
228fn tabs_passthrough_wrapped() {
232 .arg("--style=plain")
233 .arg("--decorations=always")
255 .arg("--style=plain")
256 .arg("--decorations=always")
278 .arg("--style=plain")
279 .arg("--decorations=always")
297fn tabs_passthrough() {
301 .arg("--style=plain")
302 .arg("--decorations=always")
324 .arg("--style=plain")
325 .arg("--decorations=always")
347 .arg("--style=plain")
348 .arg("--decorations=always")
366fn fail_non_existing() {
367 bat().arg("non-existing-file").assert().failure();
372 bat().arg("sub_directory").assert().failure();
376fn do_not_exit_directory() {
378 .arg("sub_directory")
381 .stdout("hello world\n")
388 .env("PAGER", "echo pager-output")
389 .arg("--paging=always")
393 .stdout("pager-output\n");
397fn pager_overwrite() {
399 .env("PAGER", "echo other-pager")
400 .env("BAT_PAGER", "echo pager-output")
401 .arg("--paging=always")
405 .stdout("pager-output\n");
411 .env("PAGER", "echo other-pager")
412 .env("BAT_PAGER", "")
413 .arg("--paging=always")
417 .stdout("hello world\n");
421fn config_location_test() {
423 .env("BAT_CONFIG_PATH", "bat.conf")
424 .arg("--config-file")
427 .stdout("bat.conf\n");
431fn config_read_arguments_from_file() {
433 .env("BAT_CONFIG_PATH", "bat.conf")
437 .stdout("dummy-pager-from-config\n");
442 // The output will be converted to UTF-8 with a leading UTF-8 BOM
445 .arg("--decorations=always")
446 .arg("test_UTF-16LE.txt")
449 .stdout(std::str::from_utf8(b"\xEF\xBB\xBFhello world\n").unwrap());
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