test: sibling projects inherit the loading project's args
ProjectArgs loads a chain app -> lib -> leaf of LocalProjects with --debug
and a project flag. lib, loaded without .args, has to see both, and so
does its own sibling, which takes the default one level further down.
Copies loaded with `.args = {}` and with an explicit list get nothing and
exactly that list. The GitProjectSpec default is checked on the spec
itself, since a GitProject would need a repository to clone. Without the
defaults, five of its checks fail.
ProjectDependency now also loads its consumer with a project flag: the
pragma dependency must still come back with no args. Without the explicit
`.args = {}` in the pragma path it gets the consumer's flag.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
17021c6055
commit
3ad1951057
6 changed files with 175 additions and 0 deletions
|
|
@ -115,6 +115,21 @@ int main(int argc, char** argv) {
|
|||
std::println(std::cerr, "FAIL: LoadProject threw: {}", e.what());
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Host tooling gets none of the consumer's args, although a LocalProject
|
||||
// spec defaults to them: the consumer's flags would split the tool's
|
||||
// variant from every other consumer's, and its --target= would have the
|
||||
// tool's project.cpp choose for the wrong triple.
|
||||
try {
|
||||
std::array<std::string_view, 1> flavored = { "--flavor=x" };
|
||||
Configuration cfg = LoadProject(app, flavored);
|
||||
const bool found = !cfg.dependencies.empty();
|
||||
Check(found, "a consumer loaded with args still finds its pragma dependency");
|
||||
if (found) Check(cfg.dependencies[0]->projectArgs.empty(), std::format("a pragma dependency is loaded without the consumer's args (got {})", cfg.dependencies[0]->projectArgs));
|
||||
} catch (const std::exception& e) {
|
||||
std::println(std::cerr, "FAIL: LoadProject with args threw: {}", e.what());
|
||||
return 1;
|
||||
}
|
||||
Check(fs::exists(appSo), "project.so was produced");
|
||||
if (!fs::exists(appSo)) return 1;
|
||||
const fs::file_time_type firstSo = fs::last_write_time(appSo);
|
||||
|
|
|
|||
Loading…
Reference in a new issue