testing-conventions 0.0.100

Enforce testing conventions in libraries (Python, TypeScript, and Rust).
Documentation
use std::path::PathBuf;

use testing_conventions::config::load_config;

fn fixtures() -> PathBuf {
    PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("tests/fixtures/unit_coverage")
}

#[test]
fn a_functions_floor_is_part_of_the_config_schema() {
    let config = load_config(fixtures().join("rust_functions_full.toml"))
        .expect("the `functions` floor should parse");
    let coverage = config
        .rust
        .expect("the [rust] table should load")
        .coverage
        .expect("the coverage table should load");
    assert_eq!(coverage.functions, Some(100));
    assert_eq!(coverage.lines, 50);
    assert_eq!(coverage.branch, None);
}

#[test]
fn a_branch_floor_is_part_of_the_config_schema() {
    let config = load_config(fixtures().join("rust_branch_full.toml"))
        .expect("the `branch` floor should parse");
    let coverage = config
        .rust
        .expect("the [rust] table should load")
        .coverage
        .expect("the coverage table should load");
    assert_eq!(coverage.branch, Some(100));
    assert_eq!(coverage.lines, 50);
    assert_eq!(coverage.functions, None);
}