From 6a7936a26fa8e941d9fe3035dbae596b2dd57991 Mon Sep 17 00:00:00 2001 From: dddffgg Date: Sat, 31 Jan 2026 16:45:46 +0800 Subject: [PATCH] test: add integration tests for --quiet-empty flag --- tests/integration_tests.rs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index 250b3d2e..7b4e2df4 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -3654,3 +3654,33 @@ fn plain_with_sized_terminal_width() { .stdout("hello \nworld\n") .stderr(""); } + +#[test] +fn quiet_empty_suppresses_output_on_empty_stdin() { + bat() + .arg("--quiet-empty") + .write_stdin("") + .assert() + .success() + .stdout(""); +} + +#[test] +fn quiet_empty_does_not_affect_non_empty_input() { + bat() + .arg("--quiet-empty") + .write_stdin("hello\n") + .assert() + .success() + .stdout("hello\n"); +} + +#[test] +fn quiet_empty_suppresses_output_on_empty_file() { + bat() + .arg("--quiet-empty") + .arg("empty.txt") + .assert() + .success() + .stdout(""); +}