diff --git a/IDEHelper/Tests/BeefSpace.toml b/IDEHelper/Tests/BeefSpace.toml index 0fe68c29..7bf3c755 100644 --- a/IDEHelper/Tests/BeefSpace.toml +++ b/IDEHelper/Tests/BeefSpace.toml @@ -9,6 +9,10 @@ StartupProject = "Tests" BfOptimizationLevel = "O0" IntermediateType = "ObjectAndIRCode" +[Configs.Debug.Linux64] +Toolset = "GNU" +EnableRealtimeLeakCheck = false + [Configs.Test.Win64] IntermediateType = "ObjectAndIRCode" COptimizationLevel = "O2" @@ -23,6 +27,9 @@ ConfigSelections = {TestsB = {Config = "Test"}} COptimizationLevel = "O2" ConfigSelections = {TestsB = {Config = "Test"}} +[Configs.Test.Win32] +ConfigSelections = {TestsB = {Config = "Test"}} + [Configs.TestFail.Win64] PreprocessorMacros = ["TESTFAIL"] BuildKind = "Normal" diff --git a/IDEHelper/Tests/src/Delegates.bf b/IDEHelper/Tests/src/Delegates.bf index 202c5d0d..004810d4 100644 --- a/IDEHelper/Tests/src/Delegates.bf +++ b/IDEHelper/Tests/src/Delegates.bf @@ -32,6 +32,25 @@ namespace Tests { return mA + mB + a; } + + public void TestLambda() mut + { + delegate int(ref int a, ref int b) dlg = scope [&] (a, b) => + { + a += 20; + b += 30; + mA++; + return mA + a + b; + }; + + mA = 100; + int testA = 8; + int testB = 9; + Test.Assert(dlg(ref testA, ref testB) == 100+1 + 20+8 + 30+9); + Test.Assert(testA == 28); + Test.Assert(testB == 39); + Test.Assert(mA == 101); + } } struct NonSplattable @@ -53,6 +72,30 @@ namespace Tests } } + class ClassA + { + public int mA; + + public void TestLambda() + { + delegate int(ref int a, ref int b) dlg = scope (a, b) => + { + a += 20; + b += 30; + mA++; + return mA + a + b; + }; + + mA = 100; + int testA = 8; + int testB = 9; + Test.Assert(dlg(ref testA, ref testB) == 100+1 + 20+8 + 30+9); + Test.Assert(testA == 28); + Test.Assert(testB == 39); + Test.Assert(mA == 101); + } + } + [Test] public static void TestBasics() { @@ -89,6 +132,10 @@ namespace Tests dlg = scope => (ref val2).NonMutMethod; Test.Assert(dlg(9) == 319); Test.Assert(val2.mB == 300); + + val1.TestLambda(); + ClassA ca = scope .(); + ca.TestLambda(); } } } diff --git a/bin/test_build.bat b/bin/test_build.bat index fc31f062..178ef7a3 100644 --- a/bin/test_build.bat +++ b/bin/test_build.bat @@ -13,6 +13,10 @@ md stats IDE\dist\BeefBuild_d -proddir=IDEHelper\Tests -test @IF %ERRORLEVEL% NEQ 0 GOTO HADERROR +@ECHO Testing IDEHelper\Tests (Win32) +IDE\dist\BeefBuild_d -proddir=IDEHelper\Tests -test -platform=Win32 +@IF %ERRORLEVEL% NEQ 0 GOTO HADERROR + @ECHO Testing SysMSVCRT del IDE\Tests\SysMSVCRT\build\Debug_Win64\SysMSVCRT\SysMSVCRT.exe IDE\dist\BeefBuild_d -proddir=IDE\Tests\SysMSVCRT