Add new integration tests for group bytes feature

This commit is contained in:
RinHizakura authored and David Peter committed 2022-11-26 13:07:06 +01:00
1 parent 179c8f40a2
commit aeee0a1033
1 file changed
+76
+76
View File
@@ -271,3 +271,79 @@ mod display_settings {
);
}
}
mod group {
use super::hexyl;
#[test]
fn group_2_bytes() {
hexyl()
.arg("ascii")
.arg("--color=never")
.arg("-g=2")
.assert()
.success()
.stdout(
"┌────────┬─────────────────────┬─────────────────────┬────────┬────────┐\n\
│00000000│ 3031 3233 3435 3637 ┊ 3839 6162 6364 650a │01234567┊89abcde_│\n\
└────────┴─────────────────────┴─────────────────────┴────────┴────────┘\n",
);
}
#[test]
fn group_4_bytes() {
hexyl()
.arg("ascii")
.arg("--color=never")
.arg("-g=4")
.assert()
.success()
.stdout(
"┌────────┬───────────────────┬───────────────────┬────────┬────────┐\n\
│00000000│ 30313233 34353637 ┊ 38396162 6364650a │01234567┊89abcde_│\n\
└────────┴───────────────────┴───────────────────┴────────┴────────┘\n",
);
}
#[test]
fn group_8_bytes() {
hexyl()
.arg("ascii")
.arg("--color=never")
.arg("-g=8")
.assert()
.success()
.stdout(
"┌────────┬──────────────────┬──────────────────┬────────┬────────┐\n\
│00000000│ 3031323334353637 ┊ 383961626364650a │01234567┊89abcde_│\n\
└────────┴──────────────────┴──────────────────┴────────┴────────┘\n",
);
}
#[test]
fn group_bytes_plain() {
hexyl()
.arg("ascii")
.arg("--color=never")
.arg("--plain")
.arg("-g=2")
.assert()
.success()
.stdout(" 3031 3233 3435 3637 3839 6162 6364 650a \n");
}
#[test]
fn group_bytes_fill_space() {
hexyl()
.arg("--color=never")
.arg("-g=2")
.write_stdin("abc")
.assert()
.success()
.stdout(
"┌────────┬─────────────────────┬─────────────────────┬────────┬────────┐\n\
│00000000│ 6162 63 ┊ │abc ┊ │\n\
└────────┴─────────────────────┴─────────────────────┴────────┴────────┘\n",
);
}
}