mirror of
https://github.com/sharkdp/hexyl.git
synced 2026-10-26 20:16:31 +00:00
1 parent
d9723592bf
commit
b1c8606918
3 files changed
+32
No files matched your search
@@ -428,8 +428,10 @@ impl<'a, Writer: Write> Printer<'a, Writer> {
|
||||
|
||||
// Finish last line
|
||||
self.print_textline().ok();
|
||||
|
||||
if !self.header_was_printed() {
|
||||
self.header();
|
||||
writeln!(self.writer, "│ │ No content to print │ │ │ │").ok();
|
||||
}
|
||||
self.footer();
|
||||
|
||||
@@ -459,6 +461,7 @@ mod tests {
|
||||
let input = io::empty();
|
||||
let expected_string = "\
|
||||
┌────────┬─────────────────────────┬─────────────────────────┬────────┬────────┐
|
||||
│ │ No content to print │ │ │ │
|
||||
└────────┴─────────────────────────┴─────────────────────────┴────────┴────────┘
|
||||
"
|
||||
.to_owned();
|
||||
|
||||
Whitespace-only changes.
@@ -41,6 +41,35 @@ fn length_restricts_output_size() {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn prints_warning_on_empty_content() {
|
||||
hexyl()
|
||||
.arg("empty")
|
||||
.arg("--color=never")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(
|
||||
"┌────────┬─────────────────────────┬─────────────────────────┬────────┬────────┐\n\
|
||||
│ │ No content to print │ │ │ │\n\
|
||||
└────────┴─────────────────────────┴─────────────────────────┴────────┴────────┘\n",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn prints_warning_when_skipping_past_the_end() {
|
||||
hexyl()
|
||||
.arg("ascii")
|
||||
.arg("--color=never")
|
||||
.arg("--skip=1000")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(
|
||||
"┌────────┬─────────────────────────┬─────────────────────────┬────────┬────────┐\n\
|
||||
│ │ No content to print │ │ │ │\n\
|
||||
└────────┴─────────────────────────┴─────────────────────────┴────────┴────────┘\n",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fail_if_length_and_bytes_options_are_used_simultaneously() {
|
||||
hexyl()
|
||||
|
||||
Reference in new issue
Block a user