diff --git a/tests/examples/ascii b/tests/examples/ascii index 5893667..f999b43 100644 --- a/tests/examples/ascii +++ b/tests/examples/ascii @@ -1 +1 @@ -abcdefgh!?%&/() +0123456789abcde diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index c5ee3b9..0508e53 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -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", ); }