1
0
mirror of https://github.com/sharkdp/bat.git synced 2025-09-01 19:02:22 +01:00

Merge pull request #2430 from Enselic/blessable-help

Require changes to `-h` and `--help` to be blessed
This commit is contained in:
David Peter
2023-01-17 15:29:13 +01:00
committed by GitHub
7 changed files with 235 additions and 13 deletions

View File

@@ -200,6 +200,24 @@ fn line_range_multiple() {
.stdout("line 1\nline 2\nline 4\n");
}
#[test]
#[cfg_attr(any(not(feature = "git"), target_os = "windows"), ignore)]
fn short_help() {
test_help("-h", "../doc/short-help.txt");
}
#[test]
#[cfg_attr(any(not(feature = "git"), target_os = "windows"), ignore)]
fn long_help() {
test_help("--help", "../doc/long-help.txt");
}
fn test_help(arg: &str, expect_file: &str) {
let assert = bat().arg(arg).assert();
expect_test::expect_file![expect_file]
.assert_eq(&String::from_utf8_lossy(&assert.get_output().stdout));
}
#[cfg(unix)]
fn setup_temp_file(content: &[u8]) -> io::Result<(PathBuf, tempfile::TempDir)> {
let dir = tempfile::tempdir().expect("Couldn't create tempdir");