From e6ce4d81067b8b9085947f16bd0236636ad91813 Mon Sep 17 00:00:00 2001 From: Chris Hamons Date: Wed, 14 May 2014 11:09:42 -0500 Subject: Report if -run: filter matches zero tests instead of reporting success --- .gitignore | 2 ++ src/framework/Internal/Filters/SimpleNameFilter.cs | 15 +++++++++++++++ src/framework/Internal/WorkItems/CompositeWorkItem.cs | 5 +++++ 3 files changed, 22 insertions(+) diff --git a/.gitignore b/.gitignore index 0170ed7..75bb6e8 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ bin src/framework/GuiUnit.userprefs src/framework/obj/* +*.userprefs +src/TestResultConsole/obj/* diff --git a/src/framework/Internal/Filters/SimpleNameFilter.cs b/src/framework/Internal/Filters/SimpleNameFilter.cs index 6deecf5..becc675 100755 --- a/src/framework/Internal/Filters/SimpleNameFilter.cs +++ b/src/framework/Internal/Filters/SimpleNameFilter.cs @@ -22,6 +22,9 @@ // *********************************************************************** using System; +using System.Text; + + #if CLR_2_0 || CLR_4_0 using System.Collections.Generic; #endif @@ -88,5 +91,17 @@ namespace NUnit.Framework.Internal.Filters return true; return false; } + + /// + /// Returns a that represents the current . + /// + /// A that represents the current . + public override string ToString () + { + StringBuilder s = new StringBuilder("[SimpleNameFilter]: "); + foreach (var name in names) + s.Append (name + " "); + return s.ToString (); + } } } diff --git a/src/framework/Internal/WorkItems/CompositeWorkItem.cs b/src/framework/Internal/WorkItems/CompositeWorkItem.cs index 0438fad..c8a2a7a 100755 --- a/src/framework/Internal/WorkItems/CompositeWorkItem.cs +++ b/src/framework/Internal/WorkItems/CompositeWorkItem.cs @@ -88,6 +88,11 @@ namespace NUnit.Framework.Internal.WorkItems RunChildren(); return; } + else + { + Console.WriteLine("No tests found that match filter: " + _childFilter.ToString() + "\n"); + Result.SetResult(ResultState.Inconclusive); + } } // Fall through in case there were no child tests to run. -- cgit v1.2.3