Added simple unit test
continuous-integration/drone/push Build is passing Details

This commit is contained in:
jpk 2022-12-15 13:33:11 +01:00
parent 8a72ef7e21
commit 43944cadfe
1 changed files with 20 additions and 0 deletions

View File

@ -58,3 +58,23 @@ pub fn hexdump(mut reader: Box<dyn io::Read>, length: usize) {
}
}
}
#[cfg(test)]
mod tests {
use super::{dump_to_chr, dump_to_hex};
#[test]
fn dump_to_chr_test() {
let mut buf = [0; 1];
assert_eq!("\u{1b}[38;5;8m.\u{1b}[39m", dump_to_chr(&mut buf[0..1]));
}
#[test]
fn dump_to_hex_test() {
let mut buf = [0; 1];
assert_eq!(
"\u{1b}[38;5;8m00\u{1b}[39m ",
dump_to_hex(&mut buf[0..1])
);
}
}