test(build): a source's declaration and imports, as its compile reads them
SourceScan builds copies of six fixtures and checks what the build read in their sources, by the modules and units it gives each configuration, and runs the program where what it does depends on that: - text, three of the four inputs of #45: `import Base;` and `import Spaced ;` are imports, and an import in a comment that spans lines or under #if 0 is none. A build with nothing changed then rewrites none of the scans, and one that cannot be read is taken again. - quoted, the fourth: an implementation source whose string literal holds "export module std;" is a unit of no module, and the build succeeds. - partition: a .cppm that declares an implementation partition (`module X:Impl;`) is the partition Impl of X, and the implementation unit that imports it has its edge to it. - define: an #ifdef on a define that the test sets after listing the source decides whether the source imports a module. - switch: an #if on a header of the library the app is built on decides it. The header is edited, and the source is scanned again; then the app is built on another library, whose header of that name says the other thing, so that only the command the scan was taken with has changed. - missing: an #include of a header that is not there fails the build with a message naming the header, and nothing is compiled of the source. On the engine of the range's base, with only this test added, every case but missing fails. Each of the three inputs of the text case is read the old way, and its first build fails outright whenever Spaced.cppm, whose import of Base was missed, is compiled before Base's BMI is there; the string literal makes the listing throw "Module std not found not found", and the implementation partition the listing of the partition case, "No module declaration found"; the import under the #ifdef counts without the define, and the one under the #if after the edit and after the swap; and there is no scan to look at. The missing case passes there too, the compile reporting the header as the scan now does.
This commit is contained in:
parent
3c8f4ddb54
commit
08a506d34b
23 changed files with 483 additions and 0 deletions
8
tests/SourceScan/fixture/missing/main.cpp
Normal file
8
tests/SourceScan/fixture/missing/main.cpp
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
// SPDX-License-Identifier: LGPL-3.0-only
|
||||
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
|
||||
|
||||
#include "not-there.h"
|
||||
|
||||
int main() {
|
||||
return 0;
|
||||
}
|
||||
Loading…
Reference in a new issue