From bb6a3c0650125e7e1cdf76ac296cf8fe823ae660 Mon Sep 17 00:00:00 2001 From: sharkdp Date: Thu, 29 Oct 2020 21:11:17 +0100 Subject: [PATCH] Add test for --length, fix #105 --- src/bin/hexyl.rs | 1 + tests/examples/hello_world_elf64 | Bin 0 -> 8488 bytes tests/integration_tests.rs | 26 ++++++++++++++++++++++++++ 3 files changed, 27 insertions(+) create mode 100755 tests/examples/hello_world_elf64 diff --git a/src/bin/hexyl.rs b/src/bin/hexyl.rs index 849dc7c2..597e5cd1 100644 --- a/src/bin/hexyl.rs +++ b/src/bin/hexyl.rs @@ -46,6 +46,7 @@ fn run() -> Result<(), AnyhowError> { .long("bytes") .takes_value(true) .value_name("N") + .conflicts_with("length") .help("An alias for -n/--length"), ) .arg( diff --git a/tests/examples/hello_world_elf64 b/tests/examples/hello_world_elf64 new file mode 100755 index 0000000000000000000000000000000000000000..1257b9d2c8f04fd0db33315e0433b095f5b61cdf GIT binary patch literal 8488 zcmeI2J#GRq5QQIqDT0KcqKafX3bZv9+9pv7F0m0vDON%POQC~f0XYNr$T8w)dw?Wu znkdi3JioEWtNl9f?Cx>?)NC|hqlp=!>z6T=A~1H*=G+u5lxT;@z3uB#n3dTj{m9M~ z{ghx`htuqlpJ)1zw!zf)vF?s*jv)+JMltOr2UDxdX^9AkfCz|y2#A0Ph=2%)fCz|y z2>eR|Ctj3~ygk43YJK2c{=7eMe%^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()