From 3b088a4b4df40cf319f8a131b454ac3b15c9f0f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wies=C5=82aw=20=C5=A0olt=C3=A9s?= Date: Wed, 14 Sep 2016 00:20:40 +0200 Subject: [PATCH] Fix unit tests search pattern --- build.cake | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/build.cake b/build.cake index e3507d05fa..8806f29cec 100644 --- a/build.cake +++ b/build.cake @@ -635,21 +635,19 @@ Task("Run-Unit-Tests") .WithCriteria(() => !skipTests) .Does(() => { - var pattern = "./tests/Avalonia.*.UnitTests/bin/" + dirSuffix + "/Avalonia.*.UnitTests.dll"; - - Func ExcludeWindowsTests = i => { - return !(i.Path.FullPath.IndexOf("Direct2D", StringComparison.OrdinalIgnoreCase) >= 0); - }; - - var unitTests = isRunningOnWindows ? GetFiles(pattern) : GetFiles(pattern, ExcludeWindowsTests); + var unitTests = GetDirectories("./tests/Avalonia.*.UnitTests") + .Select(dir => System.IO.Path.GetFileName(dir.FullPath)) + .Where(name => isRunningOnWindows ? true : !(name.IndexOf("Direct2D", StringComparison.OrdinalIgnoreCase) >= 0)) + .Select(name => MakeAbsolute(File("./tests/" + name + "/bin/" + dirSuffix + "/" + name + ".dll"))) + .ToList(); if (isRunningOnWindows) { - var windowsTests = GetFiles("./tests/Avalonia.DesignerSupport.Tests/bin/" + dirSuffix + "/*Tests.dll") + - GetFiles("./tests/Avalonia.LeakTests/bin/" + dirSuffix + "/*Tests.dll") + - GetFiles("./tests/Avalonia.RenderTests/bin/" + dirSuffix + "/*Tests.dll"); + var windowsTests = GetFiles("./tests/Avalonia.DesignerSupport.Tests/bin/" + dirSuffix + "/*.Tests.dll") + + GetFiles("./tests/Avalonia.LeakTests/bin/" + dirSuffix + "/*.LeakTests.dll") + + GetFiles("./tests/Avalonia.RenderTests/bin/" + dirSuffix + "/*.RenderTests.dll"); - unitTests += windowsTests; + unitTests.AddRange(windowsTests); } var toolPath = (isPlatformAnyCPU || isPlatformX86) ?