mirror of
https://github.com/sharkdp/bat.git
synced 2025-09-01 19:02:22 +01:00
Fix bug for file with invalid-utf8 filenames
This commit is contained in:
4
tests/examples/test-invalid-utf8-�(.rs
vendored
Normal file
4
tests/examples/test-invalid-utf8-�(.rs
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
fn print_square(num: f64) {
|
||||
let result = f64::powf(num, 2.0);
|
||||
println!("The square of {:.2} is {:.2}.", num, result);
|
||||
}
|
@@ -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 &[
|
||||
|
Reference in New Issue
Block a user