mirror of
https://github.com/dlang-community/D-Scanner.git
synced 2025-04-26 21:30:14 +03:00
Fail unittests on DMD parsing errors (#154)
This commit is contained in:
parent
444f4e20b6
commit
65253f6121
2 changed files with 7 additions and 1 deletions
|
@ -20,10 +20,10 @@ import dsymbol.modulecache : ModuleCache;
|
|||
import std.experimental.allocator;
|
||||
import std.experimental.allocator.mallocator;
|
||||
|
||||
import dmd.parse : Parser;
|
||||
import dmd.astbase : ASTBase;
|
||||
import dmd.astcodegen;
|
||||
import dmd.frontend;
|
||||
import dmd.parse : Parser;
|
||||
|
||||
S between(S)(S value, S before, S after) if (isSomeString!S)
|
||||
{
|
||||
|
@ -390,6 +390,7 @@ void assertAnalyzerWarningsDMD(string code, const StaticAnalysisConfig config, b
|
|||
import std.stdio : File;
|
||||
import dscanner.analysis.rundmd : analyzeDmd, parseDmdModule;
|
||||
import dscanner.utils : getModuleName;
|
||||
import dmd.globals : global;
|
||||
|
||||
auto testFileName = "test.d";
|
||||
File f = File(testFileName, "w");
|
||||
|
@ -403,6 +404,10 @@ void assertAnalyzerWarningsDMD(string code, const StaticAnalysisConfig config, b
|
|||
f.close();
|
||||
|
||||
auto dmdModule = parseDmdModule(file, code);
|
||||
|
||||
if (global.errors > 0)
|
||||
throw new AssertError("Failed to parse DMD module", file);
|
||||
|
||||
if (semantic)
|
||||
dmdModule.fullSemantic();
|
||||
|
||||
|
|
|
@ -85,6 +85,7 @@ private void setupDmd()
|
|||
global.path = Strings();
|
||||
global.path.push(dmdDirPath.ptr);
|
||||
global.path.push(druntimeDirPath.ptr);
|
||||
global.errors = 0;
|
||||
initDMD();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue