test: prove long package identity semantics
This commit is contained in:
@@ -26,7 +26,8 @@ package wwi_test;
|
||||
// decl-less shapes routing the wwi_emit fallback (empty, comment-only,
|
||||
// nested dotted path a.b.c -> leaf c). Each row drives the REAL
|
||||
// producer->importer flow on BOTH stages: (a) the dep `.wwi` package
|
||||
// line equals the real leaf, (b) the dep `.wwi` is byte-identical
|
||||
// owner marker is the complete path and its package line equals the real leaf,
|
||||
// (b) the dep `.wwi` is byte-identical
|
||||
// across stages, (c) a root importing the dep RESOLVES on both stages
|
||||
// and the two importer `.s` are byte-identical. The owner units and
|
||||
// separate exports are fed straight to w6c / w6c_ww (not `ww build`):
|
||||
@@ -55,13 +56,6 @@ fn runok(dir: str, name: str, argv: []str) bool = {
|
||||
return co.termination == exec.termination.EXIT && co.code == 0;
|
||||
};
|
||||
|
||||
fn firstline(path: str) str = {
|
||||
let body: str = testenv.readfile(path);
|
||||
let nl: i32 = testenv.pos(body, "\n");
|
||||
if (nl < 0) { return body; };
|
||||
return strings.sub(body, 0, nl);
|
||||
};
|
||||
|
||||
// one positive package: build the target as primary, produce the `.wwi`
|
||||
// on both stages, require byte-id + re-parse.
|
||||
fn m2positive(pkg: str) void = {
|
||||
@@ -345,9 +339,10 @@ fn leafrow(tag: str, path: str, leaf: str, body: str, want: str) void = {
|
||||
let wav: []str = [testenv.driver("w6c_ww"), "-c", "-I", wwwwi,
|
||||
"-o", wws, prod];
|
||||
if (!runok(td, "wsprod", wav)) { fail(tag, "w6c_ww producer errored"); };
|
||||
let wantline: str = strings.concat("package ", want, ";");
|
||||
if (!testenv.same(firstline(cswwi), wantline)) {
|
||||
fail(tag, ".wwi package line is not the real leaf (BUG-C)");
|
||||
let wanthead: str = strings.concat(strings.concat(strings.concat(
|
||||
"//ww:module ", path), "\npackage "), strings.concat(want, ";\n"));
|
||||
if (!strings.hasprefix(testenv.readfile(cswwi), wanthead)) {
|
||||
fail(tag, ".wwi owner or package leaf is incomplete (BUG-C)");
|
||||
};
|
||||
|
||||
// Leg b — the dep `.wwi` is byte-identical across stages (rule 10).
|
||||
|
||||
Reference in New Issue
Block a user