Fix bug for file with invalid-utf8 filenames

This commit is contained in:
sharkdp
2020-04-21 14:09:05 +02:00
parent 47abb192bc
commit 82e20bfe14
3 changed files with 19 additions and 7 deletions

View File

@@ -628,6 +628,18 @@ fn filename_multiple_err() {
.failure();
}
#[cfg(target_os = "linux")]
#[test]
fn file_with_invalid_utf8_filename() {
use std::ffi::OsStr;
use std::os::unix::ffi::OsStrExt;
bat()
.arg(OsStr::from_bytes(b"test-invalid-utf8-\xC3(.rs"))
.assert()
.success();
}
#[test]
fn do_not_panic_regression_tests() {
for filename in &[