//! PG1-FU — positive const-construction tests for `CanonicalId::from_static`.
//!
//! Negative tests (malformed literals → const-eval panic) are best
//! exercised by inspection and the `trybuild` infrastructure if/when
//! we add it; for now, the const constructions in this file passing
//! `cargo build` is evidence that the const-validator accepts every
//! shape that should be accepted.
//!
//! See spec: `.backlog/reviewed/0600-pg1-fu-life-board-expect.md`.

use maat_sdk_types::plugin_id::CanonicalId;

const REVERSE_DNS: CanonicalId =
    CanonicalId::from_static("github.com/org/maat-game");
const RESERVED_LOCAL: CanonicalId = CanonicalId::from_static("local:dev-fixture");
const RESERVED_SYSTEM: CanonicalId = CanonicalId::from_static("system:engine");

#[test]
fn reverse_dns_canonical_id_round_trips_as_str() {
    assert_eq!(REVERSE_DNS.as_str(), "github.com/org/maat-game");
    assert!(!REVERSE_DNS.is_reserved());
}

#[test]
fn local_reserved_prefix_round_trips_and_is_reserved() {
    assert_eq!(RESERVED_LOCAL.as_str(), "local:dev-fixture");
    assert!(RESERVED_LOCAL.is_reserved());
}

#[test]
fn system_reserved_prefix_round_trips_and_is_reserved() {
    assert_eq!(RESERVED_SYSTEM.as_str(), "system:engine");
    assert!(RESERVED_SYSTEM.is_reserved());
}

#[test]
fn from_static_and_new_produce_equal_values() {
    let from_static = CanonicalId::from_static("github.com/org/maat-game");
    let from_new = CanonicalId::new("github.com/org/maat-game")
        .expect("test literal is well-formed");
    assert_eq!(from_static, from_new);
}
