Files
AILang/crates/ail/tests/nullary_app_e2e.rs
T
Brummel 832375f2ac convention: counter-prefix file naming across docs/specs/, docs/plans/, design/contracts/, design/models/
All 176 files in the four accumulating directories now use a
zero-padded 4-digit counter prefix that reflects creation order
(`NNNN-slug.md`). The counter is assigned per directory in strict
git-log creation order; ties broken alphabetically by original name.
The old `YYYY-MM-DD-` prefix on docs/specs/ and docs/plans/ files is
dropped — the date is recoverable from git log and the counter
carries the ordering.

A file's counter is stable for the life of the file: never reassigned,
never reused, never compacted. Deleted files retire their counter;
subsequent files do not fill the gap. This is the property that lets
cross-references stay literal — refs use the full filename including
the counter (`design/contracts/0007-honesty-rule.md`) so they grep
cleanly and resolve directly without a glob step.

313 cross-references updated across .md/.rs/.toml/.c/.json files
(test pins, include_str! paths, design-INDEX entries, baseline notes,
runtime C comments, inter-contract markdown links incl. bare basename
and `../models/foo.md` forms).

CLAUDE.md gets a new "File-naming convention" section spelling out
the rule and rationale. skills/brainstorm/SKILL.md and
skills/planner/SKILL.md updated so new spec/plan creation produces
counter-prefixed names from the start.

The full test suite (cargo test --workspace) passes.
2026-05-28 13:31:31 +02:00

63 lines
2.3 KiB
Rust

//! Gitea #12 RED→GREEN pin — nullary `(app f)` surface acceptance.
//!
//! Pre-fix, `ail build` rejects `examples/nullary_app_smoke.ail`
//! at parse with `parse_app_body`'s "expected at least one
//! argument" error. Post-fix (parse guard dropped), the file
//! builds, runs, and prints `"hello\n"` from the nullary `greet`
//! invoked as `(app greet)`.
//!
//! Two independent fieldtest specs flagged the same gap:
//! `docs/specs/0030-fieldtest-mut-local.md` F3 and
//! `docs/specs/0035-fieldtest-loop-recur.md` spec_gap. The
//! Form-A surface refusing nullary calls had no schema backing —
//! `Term::App.args` is `[Term...]` (zero-or-more), so the parser
//! guard was an unbacked rule.
use std::path::Path;
use std::process::Command;
fn ail_bin() -> &'static str {
env!("CARGO_BIN_EXE_ail")
}
fn build_and_run(example: &str) -> String {
let manifest_dir = env!("CARGO_MANIFEST_DIR");
let workspace = Path::new(manifest_dir).parent().unwrap().parent().unwrap();
let src = workspace.join("examples").join(example);
let tmp = std::env::temp_dir().join(format!(
"ailang_e2e_{}_{}",
example.replace('.', "_"),
std::process::id()
));
std::fs::create_dir_all(&tmp).unwrap();
let out = tmp.join("bin");
let status = Command::new(ail_bin())
.args(["build", src.to_str().unwrap(), "-o"])
.arg(&out)
.status()
.expect("ail build failed to run");
assert!(status.success(), "ail build failed for {example}");
let output = Command::new(&out).output().expect("execute binary");
assert!(
output.status.success(),
"binary {} exited non-zero",
out.display()
);
String::from_utf8(output.stdout).expect("stdout utf8")
}
/// A nullary user fn called as `(app greet)` builds and runs; the
/// nullary application surface form is the canonical zero-arg
/// shape under the resolution of Gitea #12.
#[test]
fn nullary_app_builds_and_runs() {
let out = build_and_run("nullary_app_smoke.ail");
assert_eq!(
out, "hello\n",
"nullary `(app greet)` must build, run, and emit `hello\\n`; \
got `{out}` — pre-fix surface parser rejects empty-args at \
`parse_app_body` with `expected at least one argument` (see \
Gitea #12).",
);
}