These import backend modules, and that leads to undefined symbol
regressions (backend TypeInfos referencing undefined backend init
symbols) with LDC on Windows for current master (stable is fine).
See https://github.com/ldc-developers/ldc/issues/3212.
This will allow to use the compiler as a library to implement more
unit test like tests. These tests will be able to inspect the
internals of the compiler to perform new kinds of tests that are not
possible today.
Unit tests live in the `test/unit` directory. They are written using
the built-in `unittest` blocks. The unit test framework supports
callbacks executed before and after each test. The unit test runner
allows to limit the tests executed either by file(s) and/or by UDAs.
Example:
```d
module self_test;
import support : afterEach, beforeEach;
@beforeEach initializeFrontend()
{
import dmd.frontend : initDMD;
initDMD();
}
@afterEach deinitializeFrontend()
{
import dmd.frontend : deinitializeDMD;
deinitializeDMD();
}
@("self test")
unittest
{
import std.algorithm : each;
import dmd.frontend;
findImportPaths.each!addImport;
auto t = parseModule("test.d", q{
int a = 3;
});
assert(!t.diagnostics.hasErrors);
assert(!t.diagnostics.hasWarnings);
}
```
* To run all unit tests, run: `./run.d -u`
* To run only the unit tests in a single file, run: `./run.d -u unit/self_test.d`
* To run only the unit tests matching a UDA, run: `./run.d -u --filter "self test"`
The Dub package was unconditionally running the `config.sh` shell
script to generate the `VERSION` file. A Bash shell script will not
work on Windows. Therefore the `config.sh` script has been ported to
D, which will work on both Windows and Posix.
Building the Dub package on Windows results in the following
duplicated symbols: `?backend_init@@YAXXZ` and `?backend_term@@YAXXZ`.
This is solved by excluding the `dmsc.d` file from the Dub package.
The `backend_init` and `backend_term` symbols are both defined in
`gluelayer.d` (when the `NoBackend` version is defined) and `dmsc.d`.
sed -i "s/ddmd/dmd/g" -i **/*.sdl
sed -i "s/ddmd/dmd/g" -i **/*.mak
sed -i "s/ddmd/dmd/g" -i **/*.visualdproj
sed -i "s/ddmd/dmd/g" -i **/*.vcxproj
sed -i "s/ddmd/dmd/g" -i **/*.filters
sed -i "s/ddmd/dmd/g" -i CODEOWNERS