* fix #275 - cant run tests under windows * fix typo
This commit is contained in:
parent
7ee23b3d73
commit
ce6056d4bc
|
@ -12,6 +12,11 @@ makefile has "ldc" and "gdc" targets if you'd prefer to compile with one of thes
|
|||
compilers instead of DMD. To install, simply place the generated binary (in the
|
||||
"bin" folder) somewhere on your $PATH.
|
||||
|
||||
### Testing
|
||||
Testing does not work with DUB.
|
||||
Under linux or OSX run the tests with `make test`.
|
||||
Under Windows run the tests with `build.bat test`.
|
||||
|
||||
### Installing with DUB
|
||||
|
||||
```sh
|
||||
|
|
24
build.bat
24
build.bat
|
@ -1,7 +1,8 @@
|
|||
@echo off
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
set DFLAGS=-O -release -inline
|
||||
set DFLAGS=-O -release -inline -version=StdLoggerDisableWarning
|
||||
set TESTFLAGS=-g -w -version=StdLoggerDisableWarning
|
||||
set CORE=
|
||||
set LIBDPARSE=
|
||||
set STD=
|
||||
|
@ -13,8 +14,6 @@ set LIBDDOC=
|
|||
|
||||
for %%x in (src\*.d) do set CORE=!CORE! %%x
|
||||
for %%x in (src\analysis\*.d) do set ANALYSIS=!ANALYSIS! %%x
|
||||
for %%x in (libdparse\experimental_allocator\src\std\experimental\allocator\*.d) do set STD=!STD! %%x
|
||||
for %%x in (libdparse\experimental_allocator\src\std\experimental\allocator\building_blocks\*.d) do set STD=!STD! %%x
|
||||
for %%x in (libdparse\src\dparse\*.d) do set LIBDPARSE=!LIBDPARSE! %%x
|
||||
for %%x in (libdparse\src\std\experimental\*.d) do set LIBDPARSE=!LIBDPARSE! %%x
|
||||
for %%x in (libddoc\src\ddoc\*.d) do set LIBDDOC=!LIBDDOC! %%x
|
||||
|
@ -25,6 +24,21 @@ for %%x in (dsymbol\src\dsymbol\conversion\*.d) do set DSYMBOL=!DSYMBOL! %%x
|
|||
for %%x in (containers\src\containers\*.d) do set CONTAINERS=!CONTAINERS! %%x
|
||||
for %%x in (containers\src\containers\internal\*.d) do set CONTAINERS=!CONTAINERS! %%x
|
||||
|
||||
@echo on
|
||||
dmd %CORE% %STD% %LIBDPARSE% %LIBDDOC% %ANALYSIS% %INIFILED% %DSYMBOL% %CONTAINERS% %DFLAGS% -I"libdparse\src" -I"dsymbol\src" -I"containers\src" -I"libddoc\src" -ofbin\dscanner.exe
|
||||
if "%1" == "test" goto test_cmd
|
||||
|
||||
@echo on
|
||||
dmd %CORE% %STD% %LIBDPARSE% %LIBDDOC% %ANALYSIS% %INIFILED% %DSYMBOL% %CONTAINERS% %DFLAGS% -I"libdparse\src" -I"dsymbol\src" -I"containers\src" -I"libddoc\src" -ofbin\dscanner.exe
|
||||
goto eof
|
||||
|
||||
:test_cmd
|
||||
@echo on
|
||||
set TESTNAME="bin\dscanner-unittest"
|
||||
dmd %STD% %LIBDPARSE% %LIBDDOC% %INIFILED% %DSYMBOL% %CONTAINERS% -I"libdparse\src" -I"dsymbol\src" -I"containers\src" -I"libddoc\src" -lib %TESTFLAGS% -of%TESTNAME%.lib
|
||||
if exist %TESTNAME%.lib dmd %CORE% %ANALYSIS% bin\dscanner-unittest.lib -I"src" -I"inifiled\source" -I"libdparse\src" -I"dsymbol\src" -I"containers\src" -I"libddoc\src" -unittest %TESTFLAGS% -of%TESTNAME%.exe
|
||||
if exist %TESTNAME%.exe %TESTNAME%.exe
|
||||
|
||||
if exist %TESTNAME%.obj del %TESTNAME%.obj
|
||||
if exist %TESTNAME%.lib del %TESTNAME%.lib
|
||||
if exist %TESTNAME%.exe del %TESTNAME%.exe
|
||||
|
||||
:eof
|
|
@ -50,6 +50,7 @@ void assertAnalyzerWarnings(string code, const StaticAnalysisConfig config,
|
|||
{
|
||||
import analysis.run : parseModule;
|
||||
import dparse.lexer : StringCache, Token;
|
||||
import std.ascii : newline;
|
||||
|
||||
StringCache cache = StringCache(StringCache.defaultBucketCount);
|
||||
RollbackAllocator r;
|
||||
|
@ -60,7 +61,7 @@ void assertAnalyzerWarnings(string code, const StaticAnalysisConfig config,
|
|||
|
||||
// Run the code and get any warnings
|
||||
MessageSet rawWarnings = analyze("test", m, config, moduleCache, tokens);
|
||||
string[] codeLines = code.split("\n");
|
||||
string[] codeLines = code.split(newline);
|
||||
|
||||
// Get the warnings ordered by line
|
||||
string[size_t] warnings;
|
||||
|
|
|
@ -44,6 +44,7 @@ private:
|
|||
enum KEY = "dscanner.confusing.lambda_returns_lambda";
|
||||
}
|
||||
|
||||
version(Windows) {/*because of newline in code*/} else
|
||||
unittest
|
||||
{
|
||||
import analysis.helpers : assertAnalyzerWarnings;
|
||||
|
|
Loading…
Reference in New Issue