mojique 0.1.1

A safe Rust wrapper and pool implementation around libmagic
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use insta::assert_snapshot;
use mojique::{Config, DefaultConfig};

#[test]
fn buffer() -> anyhow::Result<()> {
    // The file tests cover a broader range of flags. We mostly just want to ensure that the basic
    // functionality works, really.

    let mut handle = DefaultConfig::default().build_handle()?;
    let magic_type = handle.buffer(b"#include <stdio.h>")?;
    assert_snapshot!(magic_type, @"C source, ASCII text, with no line terminators");

    let magic_type = handle.buffer(b"")?;
    assert_snapshot!(magic_type, @"empty");

    Ok(())
}