Added simple unit test
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
8a72ef7e21
commit
43944cadfe
20
src/tohex.rs
20
src/tohex.rs
|
@ -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])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue