Cotton code
79 lines · 2.7 KB · RustRaw
use super::*;// The owner's own sentences — every one is in memory today and must stay// writable, because a refusal of the owner's words is the one failure this// guard must never have.const OWNER: &[&str] = &[    "Write PR descriptions for the AI reviewer and the audit trail, not for me.",    "cottondb.com is THE domain for Cotton — site, docs and email.",    "Push back when I'm going wrong, even when I've already decided — don't just absorb it.",    "Cotton is an operating system with a database at its centre — Mac and iOS today, Android, Linux and Windows next.",    "A memory that is only true for a while says so in its own sentence (\"valid until 24 Oct\").",    "Build runners, simulators and sessions are budgeted by Cotton itself — 24/7, and/or on any Mac.",    "English is the only supported language for now.",];#[test]fn the_owners_own_sentences_carry_no_mark() {    for sentence in OWNER {        assert_eq!(technical_mark(sentence, false), None, "{sentence}");    }}#[test]fn a_pull_request_citation_is_technical() {    for sentence in [        "A Mac whose copy is behind refuses git. (Agent decision, 27 Sep 2026, PR #1025.)",        "Host clippy runs as its own job (#1035).",        "Landed in pull request 1057.",        "See /pulls/912 for the reasoning.",    ] {        assert_eq!(            technical_mark(sentence, false),            Some(TechnicalMark::PullRequest),            "{sentence}"        );    }}#[test]fn a_file_path_is_technical_unless_the_entry_is_a_machine_fact() {    for sentence in [        "The home remote is read through scripts/lib/host-remote.sh.",        "The rule lives in crates/cotton-core/ beside the store.",        "forge.ts squash-merges on a clean state.",    ] {        assert_eq!(            technical_mark(sentence, false),            Some(TechnicalMark::FilePath),            "{sentence}"        );        assert_eq!(technical_mark(sentence, true), None, "{sentence}");    }}#[test]fn a_workflow_name_is_technical_even_on_a_machine_fact() {    for sentence in [        "verify-main.yml walks the phone app after each merge.",        "A TestFlight build is a workflow_dispatch of the build.",    ] {        assert_eq!(            technical_mark(sentence, false),            Some(TechnicalMark::Workflow),            "{sentence}"        );        assert_eq!(            technical_mark(sentence, true),            Some(TechnicalMark::Workflow),            "{sentence}"        );    }}#[test]fn the_refusal_names_the_repository() {    let refusal = technical_refusal(TechnicalMark::PullRequest, &[]);    assert!(refusal.contains("repository"));    assert!(refusal.contains("cites a pull request"));}