ww: preserve command package identities
This commit is contained in:
@@ -49,6 +49,9 @@ export type parser = struct {
|
||||
// Hidden package-driver alias for the toolchain `package test` source.
|
||||
// Empty outside that one separate-compilation edge.
|
||||
testmodule: str,
|
||||
// Selected command-family validation: main/main_test classifies the
|
||||
// package without replacing the resetmod canonical identity.
|
||||
commandpackage: bool,
|
||||
};
|
||||
|
||||
fn refill(p: *parser) void = {
|
||||
@@ -71,6 +74,7 @@ export fn parserinit(p: *parser, l: *lex) void = {
|
||||
p.pathmod = "";
|
||||
p.resetmod = "";
|
||||
p.testmodule = "";
|
||||
p.commandpackage = false;
|
||||
refill(p);
|
||||
};
|
||||
|
||||
@@ -619,7 +623,12 @@ export fn parsefile(p: *parser) *node = {
|
||||
p.testmodule, "__wwtest") == 0
|
||||
&& strings.compare(active, "__wwtest") == 0
|
||||
&& strings.compare(name, "test") == 0;
|
||||
if (strings.compare(name, last) != 0 && !testsupport) {
|
||||
let commandpackage: bool = p.commandpackage
|
||||
&& p.pathmod.len == 0 && p.resetmod.len != 0
|
||||
&& (strings.compare(name, "main") == 0
|
||||
|| strings.compare(name, "main_test") == 0);
|
||||
if (strings.compare(name, last) != 0 && !testsupport
|
||||
&& !commandpackage) {
|
||||
errmsg(p, "package does not match import path");
|
||||
};
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user