diff --git a/Makefile b/Makefile index 33928ea..89eb677 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ LIBNAME=orange DC?=dmd PREFIX?=/usr/local -#Warning, unittests fail with VERSION=release +#Note: unittests now work well with -inline and -release VERSION?=standard LIBDIR=lib/$(MODEL) ARCH=$(shell arch || uname -m) diff --git a/Makefile.win b/Makefile.win index b1adaf2..daf742f 100644 --- a/Makefile.win +++ b/Makefile.win @@ -40,7 +40,7 @@ LIBNAME=orange PREFIX?=Install DC?=dmd -#Warning, unittests fail with VERSION=release +#Note: unittests now work well with -inline and -release VERSION?=standard LIBDIR=lib/$(MODEL) diff --git a/orange/serialization/archives/Archive.d b/orange/serialization/archives/Archive.d index 4aa210d..ba850a3 100644 --- a/orange/serialization/archives/Archive.d +++ b/orange/serialization/archives/Archive.d @@ -1348,7 +1348,9 @@ abstract class ArchiveBase (U) : Archive static if (isFloatingPoint!(T)) return floatingPointToData(value); - else + //Note: Inlining bug workaround: "if(true)" is necessary to prevent + // omission of "else" clause. Also works with: "if (!isFloatingPoint!(T))". + else if (true) return to!(Data)(value); } @@ -1383,7 +1385,9 @@ abstract class ArchiveBase (U) : Archive static if (is(T == wchar)) return toWchar(value); - else + //Note: Inlining bug workaround: "if(true)" is necessary to prevent + // omission of "else" clause. Also works with: "if (!isFloatingPoint!(T))". + else if (true) return to!(T)(value); } diff --git a/tests/Primitive.d b/tests/Primitive.d index 58f2168..fcbb254 100644 --- a/tests/Primitive.d +++ b/tests/Primitive.d @@ -103,7 +103,10 @@ unittest h.ushort_ = 1U; h.wchar_ = 'c'; - enum zero = "0x0p+0"; + version(Windows) + enum zero = "0x0.p+0"; + else + enum zero = "0x0p+0"; describe("serialize primitives") in { it("should return serialized primitives") in { diff --git a/unittest.bat b/unittest.bat new file mode 100644 index 0000000..8554e0c --- /dev/null +++ b/unittest.bat @@ -0,0 +1,42 @@ +@echo off +REM ___Builds and runs Orange unit tests___ + + +rem Test for 'delayed environment variable expansion': +set TESTVAR=before +if "%TESTVAR%" == "before" ( + set TESTVAR=after + if not "!TESTVAR!" == "after" ( + rem Enabling env var expansion with /V, to build the list of .d files: + cmd.exe /V /C unittest.bat + exit /B + ) +) + + +rem Build list of .d files: +set dfiles= +for %%D in ( + orange\core + orange\serialization + orange\serialization\archives + orange\test + orange\util + orange\util\collection + orange\xml + tests +) do ( + for %%X in (%%D\*.d) do ( + set dfiles=!dfiles! %%X + ) +) + + +rem Compile: +dmd -unittest -ofunittest %dfiles% + + +rem Run (only if compilation succeded): +if "%errorlevel%" == "0" ( + .\unittest.exe +) \ No newline at end of file