summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulian Sitkevich <1553398+sitkevij@users.noreply.github.com>2020-10-26 09:59:28 -0700
committerGitHub <noreply@github.com>2020-10-26 09:59:28 -0700
commitf6a99173c7199cc8a199c5ddc68b3fc2e3a02af9 (patch)
treec00c9c5e53657bd469435557da4c3e47e555e2b6
parentee50c6b9d06593801b69c1748ac4a1533a6e138c (diff)
parentb6aa587bdb789ff61358890af0a5eb47b89bdc8d (diff)
Merge pull request #32 from sitkevij/changes/prepare-release-031
#30 #31 resolve clippy lints, add test script
-rw-r--r--Cargo.lock2
-rw-r--r--Cargo.toml2
-rw-r--r--src/lib.rs4
-rw-r--r--src/main.rs2
-rwxr-xr-xtests.sh12
5 files changed, 17 insertions, 5 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 5c49a10..10c09f4 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -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)",
diff --git a/Cargo.toml b/Cargo.toml
index a1c0727..10e5880 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -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
diff --git a/src/lib.rs b/src/lib.rs
index 48af7b6..8344cff 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -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