lamarge 0.9.0

Client for the LaMarge API: sign-in, takes, transfers, withdrawals and market making, each request checked before it is signed.
Documentation
use std::path::Path;

/// Every detail is one of these constants: no check in `src/protocol` or `src/book.rs` builds
/// a failure from a literal.
#[test]
fn checks_report_no_literal_detail() {
    fn visit(path: &Path, offenders: &mut Vec<String>) {
        if path.is_dir() {
            for entry in std::fs::read_dir(path).unwrap() {
                visit(&entry.unwrap().path(), offenders);
            }
            return;
        }
        let text = std::fs::read_to_string(path).unwrap();
        let literals = [
            "differs(\"",
            "stale(\"",
            "changed(\"",
            "deployment(\"",
            "unsupported(\"",
            "detail: \"",
        ];
        offenders.extend(
            literals
                .iter()
                .filter(|literal| text.contains(*literal))
                .map(|literal| format!("{}: {literal}", path.display())),
        );
    }
    let src = Path::new(env!("CARGO_MANIFEST_DIR")).join("src");
    let mut offenders = Vec::new();
    visit(&src.join("protocol"), &mut offenders);
    visit(&src.join("book.rs"), &mut offenders);
    assert!(offenders.is_empty(), "literal details: {offenders:?}");
}