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

Merge branch 'master' into master

This commit is contained in:
John Cavanaugh
2025-08-19 20:34:08 -07:00
committed by GitHub
27 changed files with 222 additions and 94 deletions

Binary file not shown.

BIN
tests/examples/test_UTF-16BE.txt vendored Normal file

Binary file not shown.

Binary file not shown.

View File

@@ -1452,6 +1452,38 @@ fn utf16() {
.assert()
.success()
.stdout("hello world\n");
bat()
.arg("--plain")
.arg("--decorations=always")
.arg("test_UTF-16BE.txt")
.assert()
.success()
.stdout("hello world\nthis is a test\n");
}
#[test]
fn utf16le() {
bat()
.arg("--decorations=always")
.arg("--style=numbers")
.arg("--color=never")
.arg("test_UTF-16LE-complicated.txt")
.assert()
.success()
.stdout(" 1 上一伊刀\n 2 foo bar\n 3 hello world\n");
}
#[test]
fn utf16be() {
bat()
.arg("--decorations=always")
.arg("--style=numbers")
.arg("--color=never")
.arg("test_UTF-16BE-complicated.txt")
.assert()
.success()
.stdout(" 1 上一伊刀\n 2 foo bar\n 3 hello world\n");
}
// Regression test for https://github.com/sharkdp/bat/issues/1922

View File

@@ -75,7 +75,7 @@ fn create_sample_directory() -> Result<TempDir, git2::Error> {
// Copy over `sample.rs`
let sample_path = temp_dir.path().join("sample.rs");
println!("{:?}", &sample_path);
println!("{sample_path:?}");
fs::copy("tests/snapshots/sample.rs", &sample_path).expect("successful copy");
// Commit

View File

@@ -19,7 +19,7 @@ fn get_mocked_pagers_dir() -> PathBuf {
pub fn from(base: &str) -> String {
let mut cmd_and_args = shell_words::split(base).unwrap();
let suffix = if cfg!(windows) { ".bat" } else { "" };
let mut out_cmd = format!("{}{}", cmd_and_args.first().unwrap(), suffix);
let mut out_cmd = format!("{}{suffix}", cmd_and_args.first().unwrap());
if (cmd_and_args.len() > 1) {
out_cmd.push(' ');