diff options
author | Julian Sitkevich <1553398+sitkevij@users.noreply.github.com> | 2020-10-26 09:59:28 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-26 09:59:28 -0700 |
commit | f6a99173c7199cc8a199c5ddc68b3fc2e3a02af9 (patch) | |
tree | c00c9c5e53657bd469435557da4c3e47e555e2b6 | |
parent | ee50c6b9d06593801b69c1748ac4a1533a6e138c (diff) | |
parent | b6aa587bdb789ff61358890af0a5eb47b89bdc8d (diff) |
Merge pull request #32 from sitkevij/changes/prepare-release-031
#30 #31 resolve clippy lints, add test script
-rw-r--r-- | Cargo.lock | 2 | ||||
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | src/lib.rs | 4 | ||||
-rw-r--r-- | src/main.rs | 2 | ||||
-rwxr-xr-x | tests.sh | 12 |
5 files changed, 17 insertions, 5 deletions
@@ -39,7 +39,7 @@ dependencies = [ [[package]] name = "hx" -version = "0.3.0" +version = "0.3.1" dependencies = [ "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -7,7 +7,7 @@ repository = "https://github.com/sitkevij/hex" keywords = ["hexdump", "hexadecimal", "tools", "ascii", "hex"] license = "MIT" name = "hx" -version = "0.3.0" +version = "0.3.1" edition = "2018" # see https://doc.rust-lang.org/cargo/reference/manifest.html @@ -321,7 +321,7 @@ pub fn run(matches: ArgMatches) -> Result<(), Box<dyn Error>> { byte_column = 0x0; let ascii_string: String = ascii_line.ascii.iter().cloned().collect(); ascii_line = Line::new(); - write!(locked, "{}\n", ascii_string)?; // print ascii string + writeln!(locked, "{}", ascii_string)?; // print ascii string } if true { writeln!(locked, " bytes: {}", page.bytes)?; @@ -394,7 +394,7 @@ pub fn output_array( write!(locked, "{}, ", hex_lower_hex(*hex))?; } } - writeln!(locked, "")?; + writeln!(locked)?; } writeln!( diff --git a/src/main.rs b/src/main.rs index d008aba..0cae610 100644 --- a/src/main.rs +++ b/src/main.rs @@ -85,7 +85,7 @@ fn main() { process::exit(0); } Err(e) => { - eprintln!("error = \"{}\"", e); + eprintln!("error: {}", e); process::exit(1); } } diff --git a/tests.sh b/tests.sh new file mode 100755 index 0000000..f199f81 --- /dev/null +++ b/tests.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +# param ordering 1 +target/debug/hx -ar tests/files/tiny.txt +# param ordering 2 +target/debug/hx tests/files/tiny.txt -ar +# missing len param +target/debug/hx --len tests/files/tiny.txt +# missing file name +target/debug/hx missing-file +# simulate broken pipe +dd if=/dev/random bs=512 count=10 | RUST_BACKTRACE=1 target/debug/hx | head -n 10 |