diff --git a/src/Pickles/Pickles.MSBuild/Pickles.cs b/src/Pickles/Pickles.MSBuild/Pickles.cs index d9fbee1d0..fd7458cf7 100644 --- a/src/Pickles/Pickles.MSBuild/Pickles.cs +++ b/src/Pickles/Pickles.MSBuild/Pickles.cs @@ -19,6 +19,7 @@ // -------------------------------------------------------------------------------------------------------------------- using System; +using System.Collections.Generic; using System.IO.Abstractions; using System.Reflection; using Autofac; @@ -55,6 +56,8 @@ public class Pickles : Task public string ExcludeTags { get; set; } + public string StopOnParsingError { get; set; } + public override bool Execute() { try @@ -121,7 +124,17 @@ private void CaptureConfiguration(IConfiguration configuration, IFileSystem file if (!string.IsNullOrEmpty(this.ExcludeTags)) { - configuration.ExcludeTags = this.ExcludeTags; + configuration.ExcludeTags = new List(this.ExcludeTags.Split(new[] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries)); + for (int i = 0; i < configuration.ExcludeTags.Count; i++) + { + if (configuration.ExcludeTags[i][0] != '@') + configuration.ExcludeTags[i] = configuration.ExcludeTags[i].Insert(0, "@"); + } + } + + if (!string.IsNullOrEmpty(this.StopOnParsingError)) + { + configuration.StopOnParsingError = string.Equals(this.StopOnParsingError, "true", StringComparison.OrdinalIgnoreCase); } bool shouldEnableExperimentalFeatures; diff --git a/src/Pickles/Pickles.MSBuild/build/Pickles.MSBuild.targets b/src/Pickles/Pickles.MSBuild/build/Pickles.MSBuild.targets index ad3079f1c..b2fb2f393 100644 --- a/src/Pickles/Pickles.MSBuild/build/Pickles.MSBuild.targets +++ b/src/Pickles/Pickles.MSBuild/build/Pickles.MSBuild.targets @@ -19,6 +19,8 @@ DocumentationFormat="$(Pickles_DocumentationFormat)" Language="$(Pickles_Language)" IncludeExperimentalFeatures="$(Pickles_IncludeExperimentalFeatures)" - EnableComments="$(Pickles_EnableComments)" /> + EnableComments="$(Pickles_EnableComments)" + ExcludeTags="$(Pickles_ExcludeTags" + StopOnParsingError="$(Pickles_StopOnParsingError"/> \ No newline at end of file diff --git a/src/Pickles/Pickles.ObjectModel/IConfiguration.cs b/src/Pickles/Pickles.ObjectModel/IConfiguration.cs index b5ddad121..2ed49562d 100644 --- a/src/Pickles/Pickles.ObjectModel/IConfiguration.cs +++ b/src/Pickles/Pickles.ObjectModel/IConfiguration.cs @@ -47,7 +47,9 @@ public interface IConfiguration bool ShouldIncludeExperimentalFeatures { get; } - string ExcludeTags { get; set; } + List ExcludeTags { get; set; } + + bool StopOnParsingError { get; set; } void AddTestResultFile(FileInfoBase fileInfoBase); diff --git a/src/Pickles/Pickles.PowerShell/Pickle_Features.cs b/src/Pickles/Pickles.PowerShell/Pickle_Features.cs index 40910c912..4488e2098 100644 --- a/src/Pickles/Pickles.PowerShell/Pickle_Features.cs +++ b/src/Pickles/Pickles.PowerShell/Pickle_Features.cs @@ -21,6 +21,7 @@ #if __MonoCS__ #else using System; +using System.Collections.Generic; using System.IO.Abstractions; using System.Management.Automation; using System.Reflection; @@ -66,6 +67,9 @@ public class Pickle_Features : PSCmdlet [Parameter(HelpMessage = CommandLineArgumentParser.HelpExcludeTags, Mandatory = false)] public string ExcludeTags { get; set; } + [Parameter(HelpMessage = CommandLineArgumentParser.HelpStopOnParsingError, Mandatory = false)] + public string StopOnParsingError { get; set; } + protected override void ProcessRecord() { var builder = new ContainerBuilder(); @@ -128,7 +132,17 @@ private void ParseParameters(IConfiguration configuration, IFileSystem fileSyste if (!string.IsNullOrEmpty(this.ExcludeTags)) { - configuration.ExcludeTags = this.ExcludeTags; + configuration.ExcludeTags = new List(this.ExcludeTags.Split(new[] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries)); + for (int i = 0; i < configuration.ExcludeTags.Count; i++) + { + if (configuration.ExcludeTags[i][0] != '@') + configuration.ExcludeTags[i] = configuration.ExcludeTags[i].Insert(0, "@"); + } + } + + if (!string.IsNullOrEmpty(this.StopOnParsingError)) + { + configuration.StopOnParsingError = string.Equals(this.StopOnParsingError, "true", StringComparison.OrdinalIgnoreCase); } bool shouldEnableComments; diff --git a/src/Pickles/Pickles.Test/BaseFixture.cs b/src/Pickles/Pickles.Test/BaseFixture.cs index 0c2e229cc..50cdb353a 100644 --- a/src/Pickles/Pickles.Test/BaseFixture.cs +++ b/src/Pickles/Pickles.Test/BaseFixture.cs @@ -44,7 +44,7 @@ protected IContainer Container { var builder = new ContainerBuilder(); - var configuration = new Configuration() { ExcludeTags = "exclude-tag" }; + var configuration = new Configuration() { ExcludeTags = new List(new []{"@exclude-tag"}) }; builder.RegisterAssemblyTypes(typeof(Runner).Assembly); builder.Register(_ => CreateMockFileSystem()).As().SingleInstance(); builder.RegisterModule(); diff --git a/src/Pickles/Pickles.Test/WhenParsingCommandLineArguments.cs b/src/Pickles/Pickles.Test/WhenParsingCommandLineArguments.cs index 78a4210c7..de1ba0a8b 100644 --- a/src/Pickles/Pickles.Test/WhenParsingCommandLineArguments.cs +++ b/src/Pickles/Pickles.Test/WhenParsingCommandLineArguments.cs @@ -601,14 +601,15 @@ public void ThenSetsLanguageToEnglishByDefault() [Test] public void ThenCanParseExcludeTagsSuccessfully() { - var args = new[] { @"-excludeTags=exclude-tag" }; + var args = new[] { @"-excludeTags=@exclude-tag" }; var configuration = new Configuration(); var commandLineArgumentParser = new CommandLineArgumentParser(FileSystem); bool shouldContinue = commandLineArgumentParser.Parse(args, configuration, TextWriter.Null); Check.That(shouldContinue).IsTrue(); - Check.That(configuration.ExcludeTags).IsEqualTo("exclude-tag"); + Check.That(configuration.ExcludeTags.Count).IsEqualTo(1); + Check.That(configuration.ExcludeTags[0]).IsEqualTo("@exclude-tag"); } } } diff --git a/src/Pickles/Pickles.UserInterface/MainWindow.xaml b/src/Pickles/Pickles.UserInterface/MainWindow.xaml index 09b0bd769..2ecab08c6 100644 --- a/src/Pickles/Pickles.UserInterface/MainWindow.xaml +++ b/src/Pickles/Pickles.UserInterface/MainWindow.xaml @@ -47,6 +47,7 @@ + @@ -71,7 +72,7 @@