mirror of
https://github.com/sharkdp/bat
synced 2024-11-16 21:25:56 +00:00
Remove invalid UTF-8 file from repo, use temp file instead
This commit is contained in:
parent
82e20bfe14
commit
5449472f15
4
tests/examples/test-invalid-utf8-�(.rs
vendored
4
tests/examples/test-invalid-utf8-�(.rs
vendored
@ -1,4 +0,0 @@
|
||||
fn print_square(num: f64) {
|
||||
let result = f64::powf(num, 2.0);
|
||||
println!("The square of {:.2} is {:.2}.", num, result);
|
||||
}
|
@ -632,12 +632,26 @@ fn filename_multiple_err() {
|
||||
#[test]
|
||||
fn file_with_invalid_utf8_filename() {
|
||||
use std::ffi::OsStr;
|
||||
use std::fs::File;
|
||||
use std::io::Write;
|
||||
use std::os::unix::ffi::OsStrExt;
|
||||
|
||||
use tempdir::TempDir;
|
||||
|
||||
let tmp_dir = TempDir::new("bat_test").expect("can create temporary directory");
|
||||
let file_path = tmp_dir
|
||||
.path()
|
||||
.join(OsStr::from_bytes(b"test-invalid-utf8-\xC3(.rs"));
|
||||
{
|
||||
let mut file = File::create(&file_path).expect("can create temporary file");
|
||||
writeln!(file, "dummy content").expect("can write to file");
|
||||
}
|
||||
|
||||
bat()
|
||||
.arg(OsStr::from_bytes(b"test-invalid-utf8-\xC3(.rs"))
|
||||
.arg(file_path.as_os_str())
|
||||
.assert()
|
||||
.success();
|
||||
.success()
|
||||
.stdout("dummy content\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
Loading…
Reference in New Issue
Block a user