Refine the support of byte grouping

This commit is contained in:
RinHizakura authored and David Peter committed 2022-11-26 13:07:06 +01:00
1 parent 55fed5e3c0
commit c0f94ad6aa
2 files changed
+30 -17

No files matched your search

+24 -13
View File
@@ -280,13 +280,13 @@ mod group {
hexyl()
.arg("ascii")
.arg("--color=never")
.arg("-g=2")
.arg("--group-bytes=2")
.assert()
.success()
.stdout(
"┌────────┬─────────────────────┬─────────────────────┬────────┬────────┐\n\
│00000000│ 3031 3233 3435 3637 ┊ 3839 6162 6364 650a │01234567┊89abcde_│\n\
└────────┴─────────────────────┴─────────────────────┴────────┴────────┘\n",
│00000000│ 3031 3233 3435 3637 ┊ 3839 6162 6364 650a │01234567┊89abcde_│\n\
└────────┴─────────────────────┴─────────────────────┴────────┴────────┘\n",
);
}
@@ -295,13 +295,13 @@ mod group {
hexyl()
.arg("ascii")
.arg("--color=never")
.arg("-g=4")
.arg("--group-bytes=4")
.assert()
.success()
.stdout(
"┌────────┬───────────────────┬───────────────────┬────────┬────────┐\n\
│00000000│ 30313233 34353637 ┊ 38396162 6364650a │01234567┊89abcde_│\n\
└────────┴───────────────────┴───────────────────┴────────┴────────┘\n",
│00000000│ 30313233 34353637 ┊ 38396162 6364650a │01234567┊89abcde_│\n\
└────────┴───────────────────┴───────────────────┴────────┴────────┘\n",
);
}
@@ -310,13 +310,13 @@ mod group {
hexyl()
.arg("ascii")
.arg("--color=never")
.arg("-g=8")
.arg("--group-bytes=8")
.assert()
.success()
.stdout(
"┌────────┬──────────────────┬──────────────────┬────────┬────────┐\n\
│00000000│ 3031323334353637 ┊ 383961626364650a │01234567┊89abcde_│\n\
└────────┴──────────────────┴──────────────────┴────────┴────────┘\n",
│00000000│ 3031323334353637 ┊ 383961626364650a │01234567┊89abcde_│\n\
└────────┴──────────────────┴──────────────────┴────────┴────────┘\n",
);
}
@@ -326,7 +326,7 @@ mod group {
.arg("ascii")
.arg("--color=never")
.arg("--plain")
.arg("-g=2")
.arg("--group-bytes=2")
.assert()
.success()
.stdout(" 3031 3233 3435 3637 3839 6162 6364 650a \n");
@@ -336,14 +336,25 @@ mod group {
fn group_bytes_fill_space() {
hexyl()
.arg("--color=never")
.arg("-g=2")
.arg("--group-bytes=2")
.write_stdin("abc")
.assert()
.success()
.stdout(
"┌────────┬─────────────────────┬─────────────────────┬────────┬────────┐\n\
│00000000│ 6162 63 ┊ │abc ┊ │\n\
└────────┴─────────────────────┴─────────────────────┴────────┴────────┘\n",
│00000000│ 6162 63 ┊ │abc ┊ │\n\
└────────┴─────────────────────┴─────────────────────┴────────┴────────┘\n",
);
}
#[test]
fn group_bytes_invalid() {
hexyl()
.arg("ascii")
.arg("--color=never")
.arg("--plain")
.arg("--group-bytes=3")
.assert()
.failure();
}
}