Change ASCII file to contain increasing hex digits

This commit is contained in:
sharkdp authored and David Peter committed 2020-11-01 22:56:59 +01:00
1 parent 1db77094da
commit 6b2cc80cc1
2 files changed
+24 -8

No files matched your search

+1 -1
View File
@@ -1 +1 @@
abcdefgh!?%&/()
0123456789abcde
+23 -7
View File
@@ -18,7 +18,7 @@ mod basic {
.success()
.stdout(
"┌────────┬─────────────────────────┬─────────────────────────┬────────┬────────┐\n\
│00000000│ 61 62 63 64 65 66 67 68 ┊ 21 3f 25 26 2f 28 29 0a │abcdefgh┊!?%&/()_│\n\
│00000000│ 30 31 32 33 34 35 36 37 ┊ 38 39 61 62 63 64 65 0a │01234567┊89abcde_│\n\
└────────┴─────────────────────────┴─────────────────────────┴────────┴────────┘\n",
);
}
@@ -90,6 +90,22 @@ mod length {
mod skip {
use super::hexyl;
#[test]
fn basic() {
hexyl()
.arg("ascii")
.arg("--color=never")
.arg("--skip=2")
.arg("--length=4")
.assert()
.success()
.stdout(
"┌────────┬─────────────────────────┬─────────────────────────┬────────┬────────┐\n\
│00000002│ 32 33 34 35 ┊ │2345 ┊ │\n\
└────────┴─────────────────────────┴─────────────────────────┴────────┴────────┘\n",
);
}
#[test]
fn prints_warning_when_skipping_past_the_end() {
hexyl()
@@ -106,17 +122,17 @@ mod skip {
}
#[test]
fn can_handle_negative_arguments() {
fn negative_offset() {
hexyl()
.arg("ascii")
.arg("--color=never")
.arg("--skip=2")
.arg("--length=4")
.arg("--skip=-4")
.arg("--length=3")
.assert()
.success()
.stdout(
"┌────────┬─────────────────────────┬─────────────────────────┬────────┬────────┐\n\
│00000002│ 63 64 65 66 ┊ │cdef ┊ │\n\
│0000000c│ 63 64 65 ┊ │cde ┊ │\n\
└────────┴─────────────────────────┴─────────────────────────┴────────┴────────┘\n",
);
}
@@ -124,7 +140,7 @@ mod skip {
#[test]
fn fails_if_negative_offset_is_too_large() {
hexyl()
.arg("hello_world_elf64")
.arg("ascii")
.arg("--color=never")
.arg("--skip=-1MiB")
.assert()
@@ -146,7 +162,7 @@ mod display_offset {
.success()
.stdout(
"┌────────┬─────────────────────────┬─────────────────────────┬────────┬────────┐\n\
│00c0ffee│ 61 62 63 64 65 66 67 68 ┊ 21 3f 25 26 2f 28 29 0a │abcdefgh┊!?%&/()_│\n\
│00c0ffee│ 30 31 32 33 34 35 36 37 ┊ 38 39 61 62 63 64 65 0a │01234567┊89abcde_│\n\
└────────┴─────────────────────────┴─────────────────────────┴────────┴────────┘\n",
);
}