private static Exception _TryParse(string text, out TestPlanFilterPattern result) { if (text == null) { result = null; return(new ArgumentNullException()); } text = text.Trim(); if (text.Length == 0) { result = null; return(SpecFailure.AllWhitespace(nameof(text))); } string[] nv = Array.ConvertAll( text.Split(new [] { ':' }, 3), t => t.Trim() ); if (nv.Length == 2 && nv[0] == "regex") { return(_TryParseRegex(nv[1], out result)); } else { result = TestPlanFilterPattern.Wildcard(text); return(null); } }
private static Exception _TryParseRegex(string v, out TestPlanFilterPattern result) { try { result = TestPlanFilterPattern.Pattern(new Regex(v)); return(null); } catch { } result = null; return(new FormatException()); }
private void ActivateDefaultTestSet(TestRun testRun) { // Look for explicit tests SkipExplicitTests(testRun); bool emptyIncludes = Includes.Count == 0; bool emptyTags = Tags.Count == 0; if (emptyIncludes && emptyTags) { // Default configuration, which is all tests that aren't tagged Tags.Apply(testRun, SKIP_IF_HAS_ANY_TAGS); } else if (emptyIncludes) { // Only run tests that match tag Tags.Apply(testRun, ACTIVATE, SKIP); } else if (emptyTags) { // Only run tests that match includes TestPlanFilterPattern.Or(Includes).Apply(testRun, ACTIVATE, SKIP); } else { // Only run tests that match either TestPlanFilterPattern.Or(Includes).Apply(testRun, ACTIVATE, SKIP); Tags.Apply(testRun, ACTIVATE); } }
public static bool TryParse(string text, out TestPlanFilterPattern value) { return(_TryParse(text, out value) == null); }