|
1 | 1 | // What the module scanner reads: the walk pruned at `.mcpp`, defines that reach the scan, a |
2 | 2 | // private module fragment, a byte-order mark, an implementation unit in a module file, comments |
3 | 3 | // and raw strings, scan overrides of files a build excludes, a source named by a path that is |
4 | | -// not there (formerly tests/e2e/113, 167, 634, 635, 636, 639, 1064; 1096). |
| 4 | +// not there (formerly tests/e2e/113, 167, 634, 635, 636, 639, 1064; 1096, 1097). |
5 | 5 | import std; |
6 | 6 | import mcpplibs.mtest; |
7 | 7 | import mcpp.test.support; |
@@ -280,6 +280,30 @@ sources = ["src/target/unix/target.cppm"] |
280 | 280 | r = p.mcpp({"build"}); |
281 | 281 | expect(e2e::succeeded(r)) << "the build with the file in place failed\n" << s::text(r); |
282 | 282 | }; |
| 283 | + |
| 284 | + "1097 a fetched package's source named by its path that is not there is a warning"_test[s::gcc][s::fresh_sandbox] = [] { |
| 285 | + // #938, the other side: the entry is in a package fetched into a store, which its consumer |
| 286 | + // cannot change. The build is not refused; a warning names the entry. |
| 287 | + s::project p({{"local-index/pkgs/a/acme.gone.lua", R"(package = { |
| 288 | + spec = "1", namespace = "acme", name = "acme.gone", |
| 289 | + description = "fixture", licenses = {"MIT"}, type = "package", |
| 290 | + xpm = { |
| 291 | + linux = { ["1.0.0"] = { url = "u", sha256 = "0" } }, |
| 292 | + macosx = { ["1.0.0"] = { url = "u", sha256 = "0" } }, |
| 293 | + windows = { ["1.0.0"] = { url = "u", sha256 = "0" } }, |
| 294 | + }, |
| 295 | + mcpp = { language = "c++23", import_std = false, sources = { "src/gone.cppm", "src/absent.cpp" }, |
| 296 | + targets = { ["gone"] = { kind = "lib" } }, deps = {} }, |
| 297 | +} |
| 298 | +)"}, |
| 299 | + {".mcpp/.xlings/data/xpkgs/acme.gone/1.0.0/src/gone.cppm", "export module gone;\nexport int gone_value() { return 3; }\n"}, |
| 300 | + {"src/main.cpp", "import gone;\nint main() { return gone_value() == 3 ? 0 : 1; }\n"}, |
| 301 | + {"mcpp.toml", "[package]\nname = \"s1097\"\nversion = \"0.1.0\"\n\n[indices]\nacme = { path = \"local-index\" }\n\n[dependencies.acme]\ngone = \"1.0.0\"\n\n[targets.s1097]\nkind = \"bin\"\nmain = \"src/main.cpp\"\n"}}); |
| 302 | + auto r = p.mcpp({"build"}, {.where = s::home::inherited}); |
| 303 | + expect(fatal(e2e::succeeded(r))) << "a fetched package's missing file refused the build\n" << s::text(r); |
| 304 | + expect(e2e::contains(s::text(r), R"("src/absent.cpp" names no file)")) |
| 305 | + << "no warning names the entry\n" << s::text(r); |
| 306 | + }; |
283 | 307 | }}; |
284 | 308 |
|
285 | 309 | } // namespace |
0 commit comments