7ae92d3e60
closes #60 The fixture-corpus filter (NON_PARSEABLE_FIXTURES + list_ail_fixtures) was copy-pasted across three test crates and drifted out of sync as new reject fixtures landed; the examples_dir / workspace_root path walk was reimplemented ~30 more times across the suite, under two spellings (workspace_root / ws_root). Introduce crates/ailang-test-support — a zero-dependency, dev-only leaf crate — as the single home for these helpers: - NON_PARSEABLE_FIXTURES, list_ail_fixtures - workspace_root, examples_dir - canonical_workspace_root (symlink-resolved variant, for the tsan/ race tests that feed the root into native build steps) All integration-test copies across ailang-core, ailang-surface, ailang-prose, ailang-check, and ail now import from the shared crate; the local definitions and their now-orphaned path imports are removed. Path helpers resolve via the support crate's own CARGO_MANIFEST_DIR, so they return the correct absolute paths from any caller. ail_bin helpers are intentionally left in place: they depend on env!("CARGO_BIN_EXE_ail"), which Cargo only defines when compiling the ail crate's own integration tests, so they cannot move to a shared crate. Behaviour-identical: same paths, same fixture lists; full workspace test suite green. Net -177 LOC.
57 lines
1.8 KiB
Rust
57 lines
1.8 KiB
Rust
//! Baseline pin (Embedding-ABI M1, spec Testing-strategy item 0):
|
|
//! `ail build` (default executable mode) on a `main`-free module
|
|
//! surfaces `CodegenError::MissingEntryMain` at the CLI build-path
|
|
//! layer. The staticlib emit-mode (Task 5/6) is *defined* as
|
|
//! suppressing exactly this rejection; this pin guards the baseline
|
|
//! at the layer the suppression branches on. The codegen-unit layer
|
|
//! is independently pinned by
|
|
//! `crates/ailang-codegen/src/lib.rs` `missing_entry_main_is_error`.
|
|
//!
|
|
//! Pure reader: writes nothing to the repo.
|
|
|
|
use ailang_test_support::workspace_root;
|
|
use std::process::Command;
|
|
|
|
fn ail_bin() -> &'static str {
|
|
env!("CARGO_BIN_EXE_ail")
|
|
}
|
|
|
|
#[test]
|
|
fn ail_build_on_main_free_module_is_rejected_at_cli() {
|
|
let fixture = workspace_root()
|
|
.join("examples")
|
|
.join("embed_noentry_baseline.ail");
|
|
assert!(fixture.exists(), "missing fixture {fixture:?}");
|
|
|
|
let out_bin = std::env::temp_dir().join(format!(
|
|
"ailang-embed-baseline-{}", std::process::id()
|
|
));
|
|
let output = Command::new(ail_bin())
|
|
.args([
|
|
"build",
|
|
fixture.to_str().unwrap(),
|
|
"-o",
|
|
out_bin.to_str().unwrap(),
|
|
])
|
|
.output()
|
|
.expect("run `ail build`");
|
|
|
|
assert!(
|
|
!output.status.success(),
|
|
"ail build of a main-free module unexpectedly succeeded; \
|
|
stdout={} stderr={}",
|
|
String::from_utf8_lossy(&output.stdout),
|
|
String::from_utf8_lossy(&output.stderr),
|
|
);
|
|
let stderr = String::from_utf8_lossy(&output.stderr);
|
|
assert!(
|
|
stderr.contains("has no `main` def"),
|
|
"expected the MissingEntryMain message \
|
|
(`entry module ... has no `main` def`); got stderr: {stderr}",
|
|
);
|
|
assert!(
|
|
!out_bin.exists(),
|
|
"no binary should be produced for a main-free module",
|
|
);
|
|
}
|