readcon-core 0.14.4

An oxidized single and multiple CON file reader and writer with FFI bindings for ergonomic C/C++ usage.
Documentation
//! Structural gate: multi-flag Codecov wiring for rust/python/julia/fortran.
//!
//! Drives `scripts/check_codecov_config.sh` so CI/config regressions fail
//! `cargo test` rather than only showing up after a silent dashboard gap.

use std::path::PathBuf;
use std::process::Command;

fn repo_root() -> PathBuf {
    PathBuf::from(env!("CARGO_MANIFEST_DIR"))
}

#[test]
fn codecov_multi_flag_config_is_wired() {
    let script = repo_root().join("scripts/check_codecov_config.sh");
    assert!(
        script.is_file(),
        "missing {}; expected structural Codecov gate",
        script.display()
    );
    let status = Command::new("bash")
        .arg(&script)
        .current_dir(repo_root())
        .status()
        .expect("failed to spawn scripts/check_codecov_config.sh");
    assert!(
        status.success(),
        "scripts/check_codecov_config.sh failed (exit {:?})",
        status.code()
    );
}

#[test]
fn codecov_yml_declares_binding_flags() {
    let yml = std::fs::read_to_string(repo_root().join("codecov.yml"))
        .expect("read codecov.yml");
    for flag in ["rust", "python", "julia", "fortran"] {
        assert!(
            yml.contains(&format!("name: {flag}")) || yml.contains(&format!("name: {flag}\n")),
            "codecov.yml missing individual flag {flag}"
        );
    }
    assert!(yml.contains("carryforward: true"));
    assert!(yml.contains("informational: true"));
    assert!(yml.contains("flags"));
}

#[test]
fn coverage_workflow_uploads_each_flag_soft_fail() {
    let wf = std::fs::read_to_string(repo_root().join(".github/workflows/coverage.yml"))
        .expect("read coverage.yml");
    // Active (uncommented) uploads
    for flag in ["rust", "python", "julia", "fortran"] {
        let needle = format!("flags: {flag}");
        assert!(
            wf.lines().any(|l| l.contains(&needle) && !l.trim_start().starts_with('#')),
            "coverage.yml missing active upload flags: {flag}"
        );
    }
    assert!(wf.contains("codecov/codecov-action"));
    assert!(wf.contains("fail_ci_if_error: false"));
    assert!(wf.contains("use_oidc: true"));
    assert!(wf.contains("id-token: write"));
    assert!(
        wf.contains("cargo llvm-cov") || wf.contains("run_coverage_rust.sh"),
        "coverage workflow must invoke cargo llvm-cov (directly or via script)"
    );
    assert!(
        wf.contains("pytest") || wf.contains("run_coverage_python.sh"),
        "coverage workflow must drive Python tests (pytest or run_coverage_python.sh)"
    );
    assert!(
        wf.contains("run_coverage_python.sh") || wf.contains("python_lcov.info"),
        "python flag must upload instrumented src/python.rs LCOV"
    );
    assert!(wf.contains("Coverage")); // Julia Coverage.jl
    assert!(wf.contains("lcov"));
    assert!(
        wf.contains("chemfiles") || wf.contains("run_coverage_rust"),
        "coverage should exercise chemfiles / expanded feature set"
    );
}