@@ -632,12 +632,26 @@ fn filename_multiple_err() {
632632#[test]
633633fn file_with_invalid_utf8_filename() {
634634 use std::ffi::OsStr;
635+ use std::fs::File;
636+ use std::io::Write;
635637 use std::os::unix::ffi::OsStrExt;
636638
639+ use tempdir::TempDir;
640+
641+ let tmp_dir = TempDir::new("bat_test").expect("can create temporary directory");
642+ let file_path = tmp_dir
643+ .path()
644+ .join(OsStr::from_bytes(b"test-invalid-utf8-\xC3(.rs"));
645+ {
646+ let mut file = File::create(&file_path).expect("can create temporary file");
647+ writeln!(file, "dummy content").expect("can write to file");
648+ }
649+
637650 bat()
638− .arg(OsStr::from_bytes(b"test-invalid-utf8-\xC3(.rs"))
651+ .arg(file_path.as_os_str())
639652 .assert()
640− .success();
653+ .success()
654+ .stdout("dummy content\n");
641655}
642656
643657#[test]