1
0
mirror of https://github.com/sharkdp/bat.git synced 2025-09-01 10:52:24 +01:00

Merge branch 'master' into feature/binary_as_text

This commit is contained in:
einfachIrgendwer0815
2024-10-30 12:46:11 +01:00
committed by GitHub
9 changed files with 97 additions and 84 deletions

View File

@@ -9,7 +9,6 @@ use tempfile::tempdir;
mod unix {
pub use std::fs::File;
pub use std::io::{self, Write};
pub use std::os::unix::io::FromRawFd;
pub use std::path::PathBuf;
pub use std::process::Stdio;
pub use std::thread;
@@ -300,6 +299,7 @@ fn list_themes_without_colors() {
bat()
.arg("--color=never")
.arg("--decorations=always") // trick bat into setting `Config::loop_through` to false
.arg("--list-themes")
.assert()
.success()
@@ -307,6 +307,15 @@ fn list_themes_without_colors() {
.stdout(predicate::str::contains(default_theme_chunk).normalize());
}
#[test]
fn list_themes_to_piped_output() {
bat()
.arg("--list-themes")
.assert()
.success()
.stdout(predicate::str::contains("(default)").not());
}
#[test]
#[cfg_attr(any(not(feature = "git"), target_os = "windows"), ignore)]
fn short_help() {
@@ -406,8 +415,8 @@ fn no_args_doesnt_break() {
// not exit, because in this case it is safe to read and write to the same fd, which is why
// this test exists.
let OpenptyResult { master, slave } = openpty(None, None).expect("Couldn't open pty.");
let mut master = unsafe { File::from_raw_fd(master) };
let stdin_file = unsafe { File::from_raw_fd(slave) };
let mut master = File::from(master);
let stdin_file = File::from(slave);
let stdout_file = stdin_file.try_clone().unwrap();
let stdin = Stdio::from(stdin_file);
let stdout = Stdio::from(stdout_file);