//! pd.2 (`prelude-decouple` milestone): pin that the surface-side
//! `parse_prelude` succeeds against the in-tree `examples/prelude.ail`
//! and returns a `Module` with the expected shape. Guards against
//! `prelude.ail` being silently emptied or `parse_prelude` regressing.
//!
//! The hash-stability + cross-form-identity pins live in
//! `prelude_module_hash_pin.rs`.

use ailang_surface::parse_prelude;

#[test]
fn parse_prelude_returns_module_named_prelude_with_min_defs() {
    let m = parse_prelude();
    assert_eq!(m.name, "prelude");
    // Conservative lower bound: the prelude has shipped four classes
    // (Eq, Ord, Show + the Ordering data def) plus their primitive
    // instances by milestone 24. A future content addition only
    // raises the count; an accidental emptying (or a renamed root)
    // trips this immediately.
    assert!(
        m.defs.len() >= 8,
        "expected >= 8 defs in prelude, got {}",
        m.defs.len()
    );
}
