mirror of
https://github.com/sharkdp/hexyl.git
synced 2026-10-26 20:16:31 +00:00
Add test for --length, fix #105
This commit is contained in:
1 parent
09c22e09b9
commit
bb6a3c0650
3 files changed
+27
No files matched your search
@@ -25,6 +25,32 @@ fn fails_on_non_existing_input() {
|
||||
hexyl().arg("non-existing").assert().failure();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn length_restricts_output_size() {
|
||||
hexyl()
|
||||
.arg("hello_world_elf64")
|
||||
.arg("--color=never")
|
||||
.arg("--length=32")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(
|
||||
"┌────────┬─────────────────────────┬─────────────────────────┬────────┬────────┐\n\
|
||||
│00000000│ 7f 45 4c 46 02 01 01 00 ┊ 00 00 00 00 00 00 00 00 │•ELF•••0┊00000000│\n\
|
||||
│00000010│ 02 00 3e 00 01 00 00 00 ┊ 00 10 40 00 00 00 00 00 │•0>0•000┊0•@00000│\n\
|
||||
└────────┴─────────────────────────┴─────────────────────────┴────────┴────────┘\n",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fail_if_length_and_bytes_options_are_used_simultaneously() {
|
||||
hexyl()
|
||||
.arg("hello_world_elf64")
|
||||
.arg("--length=32")
|
||||
.arg("--bytes=10")
|
||||
.assert()
|
||||
.failure();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn display_offset() {
|
||||
hexyl()
|
||||
|
||||
Reference in new issue
Block a user