use std::fs::File;
use common::*;
use insta::assert_snapshot;
use mojique::{Config, DefaultConfig};
mod common;
#[test]
fn read() -> anyhow::Result<()> {
let mut handle = DefaultConfig::default().build_handle()?;
let file = File::open(manifest_dir().join("LICENSE"))?;
let magic_type = handle.read(file)?;
assert_snapshot!(magic_type, @"ASCII text");
let magic_type = handle.read(std::io::empty())?;
assert_snapshot!(magic_type, @"empty");
let magic_type = handle.read(std::io::repeat(0))?;
assert_snapshot!(magic_type, @"data");
Ok(())
}