grit-protocol 0.5.33

Git smart protocol handlers for the grit implementation
Documentation
// @generated by scripts/sync_integration_tests.py: run it after adding, renaming
// or removing a file in this directory.

//! Every `grit-protocol` integration test in one test executable, so cargo builds and
//! links one binary instead of one per file. Each file in this directory is a
//! module here, except the `[[test]]` targets in Cargo.toml, which run in their
//! own process.
//!
//! Modules marked `full-tests` start the system `git` or build heavy fixtures;
//! they build only with `--features full-tests` (`make test-full`).

#[cfg(feature = "full-tests")]
#[path = "receive_post_callback.rs"]
mod receive_post_callback;
#[cfg(feature = "full-tests")]
#[path = "shallow_stateless_v0.rs"]
mod shallow_stateless_v0;
#[path = "spawn_guard.rs"]
mod spawn_guard;
#[path = "upload_pack_v0_multi_ack_detailed.rs"]
mod upload_pack_v0_multi_ack_detailed;

/// Fails when a file in `tests/` is neither a module above nor a `[[test]]`
/// target in Cargo.toml: with `autotests = false` cargo would never build it.
#[test]
fn every_test_file_is_compiled() {
    let entry = include_str!("integration.rs");
    let manifest = include_str!("../Cargo.toml");
    let dir = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("tests");
    let mut missing = Vec::new();
    for item in std::fs::read_dir(&dir).expect("read tests/") {
        let name = item.expect("tests/ entry").file_name();
        let Some(name) = name.to_str() else { continue };
        if !name.ends_with(".rs") || name == "integration.rs" || name.ends_with("_data.rs") {
            continue;
        }
        let module = format!("#[path = \"{name}\"]");
        let target = format!("path = \"tests/{name}\"");
        if !entry.contains(&module) && !manifest.contains(&target) {
            missing.push(name.to_owned());
        }
    }
    missing.sort();
    assert!(
        missing.is_empty(),
        "tests/{missing:?} would never be built: run `python3 scripts/sync_integration_tests.py` \
         to add them to tests/integration.rs, or give one a [[test]] entry in Cargo.toml \
         if it must run in its own process"
    );
}