|
|
|
@ -223,11 +223,17 @@ mod tests {
|
|
|
|
#[test]
|
|
|
|
#[test]
|
|
|
|
fn test_plaintext_is_text() {
|
|
|
|
fn test_plaintext_is_text() {
|
|
|
|
let s = "hello world";
|
|
|
|
let s = "hello world";
|
|
|
|
assert!(matches!(guess_content(s.as_bytes()), ProbableFileKind::Text(_)));
|
|
|
|
assert!(matches!(
|
|
|
|
|
|
|
|
guess_content(s.as_bytes()),
|
|
|
|
|
|
|
|
ProbableFileKind::Text(_)
|
|
|
|
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#[test]
|
|
|
|
#[test]
|
|
|
|
fn test_null_bytes_are_binary() {
|
|
|
|
fn test_null_bytes_are_binary() {
|
|
|
|
let s = "\0".repeat(1000);
|
|
|
|
let s = "\0".repeat(1000);
|
|
|
|
assert!(matches!(guess_content(s.as_bytes()), ProbableFileKind::Binary));
|
|
|
|
assert!(matches!(
|
|
|
|
|
|
|
|
guess_content(s.as_bytes()),
|
|
|
|
|
|
|
|
ProbableFileKind::Binary
|
|
|
|
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|