diff --git a/appveyor.yml b/appveyor.yml
index 73b580d2..e9af5e38 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -1,12 +1,12 @@
#version should be only changed with RELEASE eminent, see RELEASE.md
-version: 2.7.{build}
+version: 2.7.84-beta-{build}
image: Visual Studio 2019
clone_depth: 1
pull_requests:
- do_not_increment_build_number: true
+ do_not_increment_build_number: false
init:
- ps: |
@@ -15,8 +15,9 @@ init:
if ($env:APPVEYOR_REPO_TAG -eq "true") {
$ver = $env:APPVEYOR_REPO_TAG_NAME
if($ver.StartsWith("v") -eq $true) { $ver = $ver.Substring(1) }
- Update-AppveyorBuild -Version $ver
- }
+ Update-AppveyorBuild -Version $ver
+ }
+ - ps: Write-Host "APPVEYOR_BUILD_VERSION='$env:APPVEYOR_BUILD_VERSION'" -ForegroundColor Yellow
environment:
matrix:
@@ -57,3 +58,12 @@ deploy:
artifact: 'NuGetPackages'
on:
APPVEYOR_REPO_TAG: true
+
+#myget
+- provider: NuGet
+ server: https://www.myget.org/F/commandlineparser/api/v2/package
+ api_key:
+ secure: ltHh/DsAk+Y7qbJwzUO4+i1U+7uGTLVYXTdW0+Rk2z7jqj5DDNNlih9J8K7bU4bH
+ artifact: 'NuGetPackages'
+ symbol_server: https://www.myget.org/F/commandlineparser/symbols/api/v2/package
+
diff --git a/src/CommandLine/CommandLine.csproj b/src/CommandLine/CommandLine.csproj
index b05cbb04..b2d0c6a5 100644
--- a/src/CommandLine/CommandLine.csproj
+++ b/src/CommandLine/CommandLine.csproj
@@ -4,21 +4,21 @@
CommandLine
Library
netstandard2.0;net40;net45;net461
- $(DefineConstants);CSX_EITHER_INTERNAL;CSX_REM_EITHER_BEYOND_2;CSX_ENUM_INTERNAL;ERRH_INTERNAL;ERRH_DISABLE_INLINE_METHODS;CSX_MAYBE_INTERNAL;CSX_REM_EITHER_FUNC;CSX_REM_CRYPTORAND
+ $(DefineConstants);CSX_EITHER_INTERNAL;CSX_REM_EITHER_BEYOND_2;CSX_ENUM_INTERNAL;ERRH_INTERNAL;CSX_MAYBE_INTERNAL;CSX_REM_EITHER_FUNC;CSX_REM_CRYPTORAND;ERRH_ADD_MAYBE_METHODS
$(DefineConstants);SKIP_FSHARP
true
..\..\CommandLine.snk
true
CommandLineParser
CommandLineParser.FSharp
- gsscoder;nemec;ericnewton76
+ gsscoder;nemec;ericnewton76;moh-hassan
Command Line Parser Library
$(VersionSuffix)
0.0.0
Terse syntax C# command line parser for .NET. For FSharp support see CommandLineParser.FSharp. The Command Line Parser Library offers to CLR applications a clean and concise API for manipulating command line arguments and related tasks.
Terse syntax C# command line parser for .NET with F# support. The Command Line Parser Library offers to CLR applications a clean and concise API for manipulating command line arguments and related tasks.
- Copyright (c) 2005 - 2018 Giacomo Stelluti Scala & Contributors
- License.md
+ Copyright (c) 2005 - 2020 Giacomo Stelluti Scala & Contributors
+ MIT
CommandLine20.png
https://github.com/commandlineparser/commandline
command line;commandline;argument;option;parser;parsing;library;syntax;shell
diff --git a/src/CommandLine/Core/InstanceBuilder.cs b/src/CommandLine/Core/InstanceBuilder.cs
index 4aff4080..0ae564b5 100644
--- a/src/CommandLine/Core/InstanceBuilder.cs
+++ b/src/CommandLine/Core/InstanceBuilder.cs
@@ -98,10 +98,10 @@ public static ParserResult Build(
var validationErrors = specPropsWithValue.Validate(SpecificationPropertyRules.Lookup(tokens));
var allErrors =
- tokenizerResult.SuccessfulMessages()
+ tokenizerResult.SuccessMessages()
.Concat(missingValueErrors)
- .Concat(optionSpecPropsResult.SuccessfulMessages())
- .Concat(valueSpecPropsResult.SuccessfulMessages())
+ .Concat(optionSpecPropsResult.SuccessMessages())
+ .Concat(valueSpecPropsResult.SuccessMessages())
.Concat(validationErrors)
.Concat(setPropertyErrors)
.Memoize();
diff --git a/src/CommandLine/Core/Tokenizer.cs b/src/CommandLine/Core/Tokenizer.cs
index 9fd8863c..ba6f1ef5 100644
--- a/src/CommandLine/Core/Tokenizer.cs
+++ b/src/CommandLine/Core/Tokenizer.cs
@@ -74,7 +74,7 @@ public static Result, Error> ExplodeOptionList(
var flattened = exploded.SelectMany(x => x);
- return Result.Succeed(flattened, tokenizerResult.SuccessfulMessages());
+ return Result.Succeed(flattened, tokenizerResult.SuccessMessages());
}
public static IEnumerable Normalize(
diff --git a/src/CommandLine/Infrastructure/CSharpx/Either.cs b/src/CommandLine/Infrastructure/CSharpx/Either.cs
index f3c80585..3d985948 100644
--- a/src/CommandLine/Infrastructure/CSharpx/Either.cs
+++ b/src/CommandLine/Infrastructure/CSharpx/Either.cs
@@ -272,7 +272,7 @@ public static void Match(this Either either, Actio
#endregion
///
- /// Equivalent to monadic operation.
+ /// Equivalent to monadic operation.
/// Builds a value in case by default.
///
public static Either ToEither(this TRight value)
@@ -312,4 +312,4 @@ public static bool IsRight(this Either either)
return either.Tag == EitherType.Right;
}
}
-}
\ No newline at end of file
+}
diff --git a/src/CommandLine/Infrastructure/ErrorHandling.cs b/src/CommandLine/Infrastructure/ErrorHandling.cs
index 142e1461..8aee4bac 100644
--- a/src/CommandLine/Infrastructure/ErrorHandling.cs
+++ b/src/CommandLine/Infrastructure/ErrorHandling.cs
@@ -1,62 +1,17 @@
//Use project level define(s) when referencing with Paket.
-//#define ERRH_INTERNAL // Uncomment this to set visibility to internal.
-//#define ERRH_DISABLE_INLINE_METHODS // Uncomment this to enable method inlining when compiling for >= NET 4.5.
-//#define ERRH_BUILTIN_TYPES // Uncomment this to use built-in Unit type, instead of extenral identical CSharpx.Unit.
+//#define ERRH_INTERNAL // Uncomment or define at build time to set accessibility to internal.
+//#define ERRH_ENABLE_INLINE_METHODS // Uncomment or define at build time to enable method inlining when compiling for >= NET 4.5.
+//#define ERRH_ADD_MAYBE_METHODS // Uncomment or define at build time to add methods that use Maybe type
using System;
using System.Collections.Generic;
using System.Linq;
-using System.Runtime.CompilerServices;
-#if !ERRH_BUILTIN_TYPES
+#if ERRH_ADD_MAYBE_METHODS
using CSharpx;
#endif
namespace RailwaySharp.ErrorHandling
{
- #region Unit Type
-#if ERRH_BUILTIN_TYPES
-#if !ERRH_INTERNAL
- public
-#endif
- struct Unit : IEquatable
- {
- private static readonly Unit @default = new Unit();
-
- public bool Equals(Unit other)
- {
- return true;
- }
-
- public override bool Equals(object obj)
- {
- return obj is Unit;
- }
-
- public override int GetHashCode()
- {
- return 0;
- }
-
- public override string ToString()
- {
- return "()";
- }
-
- public static bool operator ==(Unit first, Unit second)
- {
- return true;
- }
-
- public static bool operator !=(Unit first, Unit second)
- {
- return false;
- }
-
- public static Unit Default { get { return @default; } }
- }
-#endif
- #endregion
-
#if !ERRH_INTERNAL
public
#endif
@@ -76,29 +31,28 @@ enum ResultType
#endif
abstract class Result
{
- private readonly ResultType tag;
+ private readonly ResultType _tag;
protected Result(ResultType tag)
{
- this.tag = tag;
+ _tag = tag;
}
public ResultType Tag
{
- get { return tag; }
+ get { return _tag; }
}
public override string ToString()
{
- switch (Tag)
- {
- case ResultType.Ok:
+ switch (Tag) {
+ default:
var ok = (Ok)this;
return string.Format(
"OK: {0} - {1}",
ok.Success,
string.Join(Environment.NewLine, ok.Messages.Select(v => v.ToString())));
- default:
+ case ResultType.Bad:
var bad = (Bad)this;
return string.Format(
"Error: {0}",
@@ -117,22 +71,24 @@ public override string ToString()
#endif
sealed class Ok : Result
{
- private readonly Tuple> value;
+ private readonly Tuple> _value;
public Ok(TSuccess success, IEnumerable messages)
: base(ResultType.Ok)
{
- this.value = Tuple.Create(success, messages);
+ if (messages == null) throw new ArgumentNullException(nameof(messages));
+
+ _value = Tuple.Create(success, messages);
}
public TSuccess Success
{
- get { return value.Item1; }
+ get { return _value.Item1; }
}
public IEnumerable Messages
{
- get { return value.Item2; }
+ get { return _value.Item2; }
}
}
@@ -146,17 +102,19 @@ public IEnumerable Messages
#endif
sealed class Bad : Result
{
- private readonly IEnumerable messages;
+ private readonly IEnumerable _messages;
public Bad(IEnumerable messages)
: base(ResultType.Bad)
{
- this.messages = messages;
+ if (messages == null) throw new ArgumentException(nameof(messages));
+
+ _messages = messages;
}
public IEnumerable Messages
{
- get { return messages; }
+ get { return _messages; }
}
}
@@ -170,6 +128,8 @@ static class Result
///
public static Result FailWith(IEnumerable messages)
{
+ if (messages == null) throw new ArgumentException(nameof(messages));
+
return new Bad(messages);
}
@@ -178,6 +138,8 @@ public static Result FailWith(IEnumerabl
///
public static Result FailWith(TMessage message)
{
+ if (message == null) throw new ArgumentException(nameof(message));
+
return new Bad(new[] { message });
}
@@ -194,6 +156,8 @@ public static Result Succeed(TSuccess va
///
public static Result Succeed(TSuccess value, TMessage message)
{
+ if (message == null) throw new ArgumentException(nameof(message));
+
return new Ok(value, new[] { message });
}
@@ -202,6 +166,8 @@ public static Result Succeed(TSuccess va
///
public static Result Succeed(TSuccess value, IEnumerable messages)
{
+ if (messages == null) throw new ArgumentException(nameof(messages));
+
return new Ok(value, messages);
}
@@ -210,13 +176,13 @@ public static Result Succeed(TSuccess va
///
public static Result Try(Func func)
{
- try
- {
+ if (func == null) throw new ArgumentException(nameof(func));
+
+ try {
return new Ok(
func(), Enumerable.Empty());
}
- catch (Exception ex)
- {
+ catch (Exception ex) {
return new Bad(
new[] { ex });
}
@@ -231,7 +197,7 @@ static class Trial
///
/// Wraps a value in a Success.
///
-#if !ERRH_DISABLE_INLINE_METHODS
+#if ERRH_ENABLE_INLINE_METHODS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
public static Result Ok(TSuccess value)
@@ -242,7 +208,7 @@ public static Result Ok(TSuccess value)
///
/// Wraps a value in a Success.
///
-#if !ERRH_DISABLE_INLINE_METHODS
+#if ERRH_ENABLE_INLINE_METHODS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
public static Result Pass(TSuccess value)
@@ -253,29 +219,33 @@ public static Result Pass(TSuccess value
///
/// Wraps a value in a Success and adds a message.
///
-#if !ERRH_DISABLE_INLINE_METHODS
+#if ERRH_ENABLE_INLINE_METHODS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
public static Result Warn(TMessage message, TSuccess value)
{
+ if (message == null) throw new ArgumentException(nameof(message));
+
return new Ok(value, new[] { message });
}
///
/// Wraps a message in a Failure.
///
-#if !ERRH_DISABLE_INLINE_METHODS
+#if ERRH_ENABLE_INLINE_METHODS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
public static Result Fail(TMessage message)
{
+ if (message == null) throw new ArgumentException(nameof(message));
+
return new Bad(new[] { message });
}
///
/// Returns true if the result was not successful.
///
-#if !ERRH_DISABLE_INLINE_METHODS
+#if ERRH_ENABLE_INLINE_METHODS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
public static bool Failed(Result result)
@@ -286,7 +256,7 @@ public static bool Failed(Result result)
///
/// Takes a Result and maps it with successFunc if it is a Success otherwise it maps it with failureFunc.
///
-#if !ERRH_DISABLE_INLINE_METHODS
+#if ERRH_ENABLE_INLINE_METHODS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
public static TResult Either(
@@ -294,9 +264,11 @@ public static TResult Either(
Func, TResult> failureFunc,
Result trialResult)
{
+ if (successFunc == null) throw new ArgumentException(nameof(successFunc));
+ if (failureFunc == null) throw new ArgumentException(nameof(failureFunc));
+
var ok = trialResult as Ok;
- if (ok != null)
- {
+ if (ok != null) {
return successFunc(ok.Success, ok.Messages);
}
var bad = (Bad)trialResult;
@@ -307,7 +279,7 @@ public static TResult Either(
/// If the given result is a Success the wrapped value will be returned.
/// Otherwise the function throws an exception with Failure message of the result.
///
-#if !ERRH_DISABLE_INLINE_METHODS
+#if ERRH_ENABLE_INLINE_METHODS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
public static TSuccess ReturnOrFail(Result result)
@@ -325,13 +297,15 @@ public static TSuccess ReturnOrFail(Result
/// Appends the given messages with the messages in the given result.
///
-#if !ERRH_DISABLE_INLINE_METHODS
+#if ERRH_ENABLE_INLINE_METHODS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
public static Result MergeMessages(
IEnumerable messages,
Result result)
{
+ if (messages == null) throw new ArgumentException(nameof(messages));
+
Func, Result> successFunc =
(succ, msgs) =>
new Ok(
@@ -347,13 +321,15 @@ public static Result MergeMessages(
/// If the result is a Success it executes the given function on the value.
/// Otherwise the exisiting failure is propagated.
///
-#if !ERRH_DISABLE_INLINE_METHODS
+#if ERRH_ENABLE_INLINE_METHODS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
public static Result Bind(
Func> func,
Result result)
{
+ if (func == null) throw new ArgumentException(nameof(func));
+
Func, Result> successFunc =
(succ, msgs) => MergeMessages(msgs, func(succ));
@@ -366,7 +342,7 @@ public static Result Bind(
///
/// Flattens a nested result given the Failure types are equal.
///
-#if !ERRH_DISABLE_INLINE_METHODS
+#if ERRH_ENABLE_INLINE_METHODS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
public static Result Flatten(
@@ -374,46 +350,44 @@ public static Result Flatten(
{
return Bind(x => x, result);
}
-
+
///
/// If the wrapped function is a success and the given result is a success the function is applied on the value.
/// Otherwise the exisiting error messages are propagated.
///
-#if !ERRH_DISABLE_INLINE_METHODS
+#if ERRH_ENABLE_INLINE_METHODS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
public static Result Apply(
Result, TMessage> wrappedFunction,
Result result)
{
- if (wrappedFunction.Tag == ResultType.Ok && result.Tag == ResultType.Ok)
- {
+ if (wrappedFunction == null) throw new ArgumentException(nameof(wrappedFunction));
+
+ if (wrappedFunction.Tag == ResultType.Ok && result.Tag == ResultType.Ok) {
var ok1 = (Ok, TMessage>)wrappedFunction;
var ok2 = (Ok)result;
return new Ok(
ok1.Success(ok2.Success), ok1.Messages.Concat(ok2.Messages));
}
- if (wrappedFunction.Tag == ResultType.Bad && result.Tag == ResultType.Ok)
- {
+ if (wrappedFunction.Tag == ResultType.Bad && result.Tag == ResultType.Ok) {
return new Bad(((Bad)result).Messages);
}
- if (wrappedFunction.Tag == ResultType.Ok && result.Tag == ResultType.Bad)
- {
+ if (wrappedFunction.Tag == ResultType.Ok && result.Tag == ResultType.Bad) {
return new Bad(
((Bad)result).Messages);
}
var bad1 = (Bad, TMessage>)wrappedFunction;
var bad2 = (Bad)result;
-
return new Bad(bad1.Messages.Concat(bad2.Messages));
}
///
/// Lifts a function into a Result container and applies it on the given result.
///
-#if !ERRH_DISABLE_INLINE_METHODS
+#if ERRH_ENABLE_INLINE_METHODS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
public static Result Lift(
@@ -426,22 +400,22 @@ public static Result Lift(
///
/// Promote a function to a monad/applicative, scanning the monadic/applicative arguments from left to right.
///
-#if !ERRH_DISABLE_INLINE_METHODS
+#if ERRH_ENABLE_INLINE_METHODS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
public static Result Lift2(
Func> func,
- Result a,
- Result b)
+ Result first,
+ Result second)
{
- return Apply(Lift(func, a), b);
+ return Apply(Lift(func, first), second);
}
///
/// Collects a sequence of Results and accumulates their values.
/// If the sequence contains an error the error will be propagated.
///
-#if !ERRH_DISABLE_INLINE_METHODS
+#if ERRH_ENABLE_INLINE_METHODS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
public static Result, TMessage> Collect(
@@ -449,21 +423,18 @@ public static Result, TMessage> Collect, Result, TMessage>, Result, TMessage>>(
- null,
- (result, next) =>
- {
- if (result.Tag == ResultType.Ok && next.Tag == ResultType.Ok)
- {
+ null,
+ (result, next) => {
+ if (result.Tag == ResultType.Ok && next.Tag == ResultType.Ok) {
var ok1 = (Ok, TMessage>)result;
var ok2 = (Ok)next;
return
new Ok, TMessage>(
- Enumerable.Empty().Concat(new[] { ok2.Success }).Concat(ok1.Success),
+ Enumerable.Empty().Concat(new [] { ok2.Success }).Concat(ok1.Success),
ok1.Messages.Concat(ok2.Messages));
}
if ((result.Tag == ResultType.Ok && next.Tag == ResultType.Bad)
- || (result.Tag == ResultType.Bad && next.Tag == ResultType.Ok))
- {
+ || (result.Tag == ResultType.Bad && next.Tag == ResultType.Ok)) {
var m1 = result.Tag == ResultType.Ok
? ((Ok, TMessage>)result).Messages
: ((Bad)next).Messages;
@@ -472,8 +443,9 @@ public static Result, TMessage> Collect)next).Messages;
return new Bad, TMessage>(m1.Concat(m2));
}
+
var bad1 = (Bad, TMessage>)result;
- var bad2 = (Bad)next;
+ var bad2 = (Bad)next;
return new Bad, TMessage>(bad1.Messages.Concat(bad2.Messages));
}, x => x));
}
@@ -490,19 +462,22 @@ static class ResultExtensions
///
/// Allows pattern matching on Results.
///
-#if !ERRH_DISABLE_INLINE_METHODS
+#if ERRH_ENABLE_INLINE_METHODS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
public static void Match(this Result result,
Action> ifSuccess,
Action> ifFailure)
{
+ if (ifSuccess == null) throw new ArgumentException(nameof(ifSuccess));
+ if (ifFailure == null) throw new ArgumentException(nameof(ifFailure));
+
var ok = result as Ok;
- if (ok != null)
- {
+ if (ok != null) {
ifSuccess(ok.Success, ok.Messages);
return;
}
+
var bad = (Bad)result;
ifFailure(bad.Messages);
}
@@ -510,26 +485,20 @@ public static void Match(this Result res
///
/// Allows pattern matching on Results.
///
-#if !ERRH_DISABLE_INLINE_METHODS
+#if ERRH_ENABLE_INLINE_METHODS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
public static TResult Either(this Result result,
Func, TResult> ifSuccess,
Func, TResult> ifFailure)
{
- var ok = result as Ok;
- if (ok != null)
- {
- return ifSuccess(ok.Success, ok.Messages);
- }
- var bad = (Bad)result;
- return ifFailure(bad.Messages);
+ return Trial.Either(ifSuccess, ifFailure, result);
}
///
/// Lifts a Func into a Result and applies it on the given result.
///
-#if !ERRH_DISABLE_INLINE_METHODS
+#if ERRH_ENABLE_INLINE_METHODS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
public static Result Map(this Result result,
@@ -542,7 +511,7 @@ public static Result Map(this Re
/// Collects a sequence of Results and accumulates their values.
/// If the sequence contains an error the error will be propagated.
///
-#if !ERRH_DISABLE_INLINE_METHODS
+#if ERRH_ENABLE_INLINE_METHODS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
public static Result, TMessage> Collect(
@@ -555,18 +524,16 @@ public static Result, TMessage> Collect
-#if !ERRH_DISABLE_INLINE_METHODS
+#if ERRH_ENABLE_INLINE_METHODS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
public static Result, TMessage> Flatten(this Result>, TMessage> result)
{
- if (result.Tag == ResultType.Ok)
- {
+ if (result.Tag == ResultType.Ok) {
var ok = (Ok>, TMessage>)result;
var values = ok.Success;
var result1 = Collect(values);
- if (result1.Tag == ResultType.Ok)
- {
+ if (result1.Tag == ResultType.Ok) {
var ok1 = (Ok, TMessage>)result1;
return new Ok, TMessage>(ok1.Success, ok1.Messages);
}
@@ -581,7 +548,7 @@ public static Result, TMessage> Flatten
-#if !ERRH_DISABLE_INLINE_METHODS
+#if ERRH_ENABLE_INLINE_METHODS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
public static Result SelectMany(this Result result,
@@ -595,7 +562,7 @@ public static Result SelectMany(
/// If the result of the Func is a Success it maps it using the given Func.
/// Otherwise the exisiting failure is propagated.
///
-#if !ERRH_DISABLE_INLINE_METHODS
+#if ERRH_ENABLE_INLINE_METHODS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
public static Result SelectMany(
@@ -603,6 +570,9 @@ public static Result SelectMany> func,
Func mapperFunc)
{
+ if (func == null) throw new ArgumentException(nameof(func));
+ if (mapperFunc == null) throw new ArgumentException(nameof(mapperFunc));
+
Func> curriedMapper = suc => val => mapperFunc(suc, val);
Func<
Result,
@@ -616,7 +586,7 @@ public static Result SelectMany
/// Lifts a Func into a Result and applies it on the given result.
///
-#if !ERRH_DISABLE_INLINE_METHODS
+#if ERRH_ENABLE_INLINE_METHODS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
public static Result Select(this Result result,
@@ -628,13 +598,12 @@ public static Result Select(this
///
/// Returns the error messages or fails if the result was a success.
///
-#if !ERRH_DISABLE_INLINE_METHODS
+#if ERRH_ENABLE_INLINE_METHODS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
public static IEnumerable FailedWith(this Result result)
{
- if (result.Tag == ResultType.Ok)
- {
+ if (result.Tag == ResultType.Ok) {
var ok = (Ok)result;
throw new Exception(
string.Format("Result was a success: {0} - {1}",
@@ -648,13 +617,12 @@ public static IEnumerable FailedWith(this Result
/// Returns the result or fails if the result was an error.
///
-#if !ERRH_DISABLE_INLINE_METHODS
+#if ERRH_ENABLE_INLINE_METHODS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
public static TSuccess SucceededWith(this Result result)
{
- if (result.Tag == ResultType.Ok)
- {
+ if (result.Tag == ResultType.Ok) {
var ok = (Ok)result;
return ok.Success;
}
@@ -663,5 +631,34 @@ public static TSuccess SucceededWith(this Result m.ToString()))));
}
+
+ ///
+ /// Returns messages in case of success, otherwise an empty sequence.
+ ///
+ public static IEnumerable SuccessMessages(this Result result)
+ {
+ if (result.Tag == ResultType.Ok) {
+ var ok = (Ok)result;
+ return ok.Messages;
+ }
+ return Enumerable.Empty();
+ }
+
+#if ERRH_ADD_MAYBE_METHODS
+#if ERRH_ENABLE_INLINE_METHODS
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+#endif
+ ///
+ /// Builds a Maybe type instance from a Result one.
+ ///
+ public static Maybe ToMaybe(this Result result)
+ {
+ if (result.Tag == ResultType.Ok) {
+ var ok = (Ok)result;
+ return Maybe.Just(ok.Success);
+ }
+ return Maybe.Nothing();
+ }
+#endif
}
}
\ No newline at end of file
diff --git a/src/CommandLine/Infrastructure/ResultExtensions.cs b/src/CommandLine/Infrastructure/ResultExtensions.cs
deleted file mode 100644
index bdc2a480..00000000
--- a/src/CommandLine/Infrastructure/ResultExtensions.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2005-2015 Giacomo Stelluti Scala & Contributors. All rights reserved. See License.md in the project root for license information.
-
-using System.Collections.Generic;
-using System.Linq;
-
-using CSharpx;
-using RailwaySharp.ErrorHandling;
-
-namespace CommandLine.Infrastructure
-{
- static class ResultExtensions
- {
- public static IEnumerable SuccessfulMessages(this Result result)
- {
- if (result.Tag == ResultType.Ok)
- {
- var ok = (Ok)result;
- return ok.Messages;
- }
- return Enumerable.Empty();
- }
-
- public static Maybe ToMaybe(this Result result)
- {
- if (result.Tag == ResultType.Ok)
- {
- var ok = (Ok)result;
- return Maybe.Just(ok.Success);
- }
- return Maybe.Nothing();
- }
- }
-}
\ No newline at end of file
diff --git a/tests/CommandLine.Tests/Fakes/Hidden_Option.cs b/tests/CommandLine.Tests/Fakes/Hidden_Option.cs
index 1917ecab..b9a87cd3 100644
--- a/tests/CommandLine.Tests/Fakes/Hidden_Option.cs
+++ b/tests/CommandLine.Tests/Fakes/Hidden_Option.cs
@@ -1,10 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace CommandLine.Tests.Fakes
+namespace CommandLine.Tests.Fakes
{
public class Hidden_Option
{
diff --git a/tests/CommandLine.Tests/Fakes/OPtions_HelpText_Ordering.cs b/tests/CommandLine.Tests/Fakes/Options_HelpText_Ordering.cs
similarity index 94%
rename from tests/CommandLine.Tests/Fakes/OPtions_HelpText_Ordering.cs
rename to tests/CommandLine.Tests/Fakes/Options_HelpText_Ordering.cs
index 3896ab67..27c7fa6b 100644
--- a/tests/CommandLine.Tests/Fakes/OPtions_HelpText_Ordering.cs
+++ b/tests/CommandLine.Tests/Fakes/Options_HelpText_Ordering.cs
@@ -1,8 +1,5 @@
// Copyright 2005-2015 Giacomo Stelluti Scala & Contributors. All rights reserved. See License.md in the project root for license information.
-using System.Collections.Generic;
-using System.Runtime.CompilerServices;
-
namespace CommandLine.Tests.Fakes
{
diff --git a/tests/CommandLine.Tests/Fakes/Options_With_Sequence_Having_Both_Min_And_Max_Equal.cs b/tests/CommandLine.Tests/Fakes/Options_With_Sequence_Having_Both_Min_And_Max_Equal.cs
index d24a8036..21671d76 100644
--- a/tests/CommandLine.Tests/Fakes/Options_With_Sequence_Having_Both_Min_And_Max_Equal.cs
+++ b/tests/CommandLine.Tests/Fakes/Options_With_Sequence_Having_Both_Min_And_Max_Equal.cs
@@ -1,9 +1,6 @@
// Copyright 2005-2015 Giacomo Stelluti Scala & Contributors. All rights reserved. See License.md in the project root for license information.
-using System;
using System.Collections.Generic;
-using System.Linq;
-using System.Text;
namespace CommandLine.Tests.Fakes
{
diff --git a/tests/CommandLine.Tests/Fakes/ResourceFakes.cs b/tests/CommandLine.Tests/Fakes/ResourceFakes.cs
index 917d51bf..f7b46bac 100644
--- a/tests/CommandLine.Tests/Fakes/ResourceFakes.cs
+++ b/tests/CommandLine.Tests/Fakes/ResourceFakes.cs
@@ -1,10 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace CommandLine.Tests.Fakes
+namespace CommandLine.Tests.Fakes
{
public static class StaticResource
{
diff --git a/tests/CommandLine.Tests/ParserProperties.cs b/tests/CommandLine.Tests/ParserProperties.cs
index ae55d18c..ceb8b524 100644
--- a/tests/CommandLine.Tests/ParserProperties.cs
+++ b/tests/CommandLine.Tests/ParserProperties.cs
@@ -1,9 +1,8 @@
// Copyright 2005-2015 Giacomo Stelluti Scala & Contributors. All rights reserved. See License.md in the project root for license information.
-using CommandLine.Tests.Properties.Fakes;
using FluentAssertions;
using FsCheck;
-using Xunit;
+using CommandLine.Tests.Properties.Fakes;
namespace CommandLine.Tests.Properties
{
diff --git a/tests/CommandLine.Tests/Unit/BaseAttributeTests.cs b/tests/CommandLine.Tests/Unit/BaseAttributeTests.cs
index 72cf81b4..3c2bfbbd 100644
--- a/tests/CommandLine.Tests/Unit/BaseAttributeTests.cs
+++ b/tests/CommandLine.Tests/Unit/BaseAttributeTests.cs
@@ -1,5 +1,4 @@
using System;
-using System.Linq;
using Xunit;
namespace CommandLine.Tests.Unit
diff --git a/tests/CommandLine.Tests/Unit/Core/InstanceBuilderTests.cs b/tests/CommandLine.Tests/Unit/Core/InstanceBuilderTests.cs
index bf885f76..c2cbb77a 100644
--- a/tests/CommandLine.Tests/Unit/Core/InstanceBuilderTests.cs
+++ b/tests/CommandLine.Tests/Unit/Core/InstanceBuilderTests.cs
@@ -13,9 +13,7 @@
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
-
using Xunit;
-using System.Reflection;
namespace CommandLine.Tests.Unit.Core
{
diff --git a/tests/CommandLine.Tests/Unit/Core/InstanceChooserTests.cs b/tests/CommandLine.Tests/Unit/Core/InstanceChooserTests.cs
index 52e12cae..c9dae5fb 100644
--- a/tests/CommandLine.Tests/Unit/Core/InstanceChooserTests.cs
+++ b/tests/CommandLine.Tests/Unit/Core/InstanceChooserTests.cs
@@ -4,10 +4,10 @@
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
+using Xunit;
+using FluentAssertions;
using CommandLine.Core;
using CommandLine.Tests.Fakes;
-using FluentAssertions;
-using Xunit;
namespace CommandLine.Tests.Unit.Core
{
diff --git a/tests/CommandLine.Tests/Unit/Core/KeyValuePairHelperTests.cs b/tests/CommandLine.Tests/Unit/Core/KeyValuePairHelperTests.cs
index 77ba39cf..3f1fb293 100644
--- a/tests/CommandLine.Tests/Unit/Core/KeyValuePairHelperTests.cs
+++ b/tests/CommandLine.Tests/Unit/Core/KeyValuePairHelperTests.cs
@@ -2,8 +2,8 @@
using System.Collections.Generic;
using System.Linq;
-using CommandLine.Core;
using Xunit;
+using CommandLine.Core;
namespace CommandLine.Tests.Unit.Core
{
diff --git a/tests/CommandLine.Tests/Unit/Core/NameLookupTests.cs b/tests/CommandLine.Tests/Unit/Core/NameLookupTests.cs
index 785b1fe5..f009c49e 100644
--- a/tests/CommandLine.Tests/Unit/Core/NameLookupTests.cs
+++ b/tests/CommandLine.Tests/Unit/Core/NameLookupTests.cs
@@ -1,15 +1,11 @@
// Copyright 2005-2015 Giacomo Stelluti Scala & Contributors. All rights reserved. See License.md in the project root for license information.
-using CommandLine.Core;
-
-using CSharpx;
-
-using FluentAssertions;
-
using System;
using System.Collections.Generic;
-
using Xunit;
+using FluentAssertions;
+using CommandLine.Core;
+using CSharpx;
namespace CommandLine.Tests.Unit.Core
{
diff --git a/tests/CommandLine.Tests/Unit/Core/OptionMapperTests.cs b/tests/CommandLine.Tests/Unit/Core/OptionMapperTests.cs
index 75ddade7..b2219683 100644
--- a/tests/CommandLine.Tests/Unit/Core/OptionMapperTests.cs
+++ b/tests/CommandLine.Tests/Unit/Core/OptionMapperTests.cs
@@ -4,18 +4,14 @@
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
-
#if PLATFORM_DOTNET
using System.Reflection;
#endif
-using CommandLine.Core;
-using CommandLine.Tests.Fakes;
-
using Xunit;
-
using CSharpx;
-
using RailwaySharp.ErrorHandling;
+using CommandLine.Core;
+using CommandLine.Tests.Fakes;
namespace CommandLine.Tests.Unit.Core
{
diff --git a/tests/CommandLine.Tests/Unit/Core/ReflectionExtensions.cs b/tests/CommandLine.Tests/Unit/Core/ReflectionExtensions.cs
index 2fdb951d..035b9e03 100644
--- a/tests/CommandLine.Tests/Unit/Core/ReflectionExtensions.cs
+++ b/tests/CommandLine.Tests/Unit/Core/ReflectionExtensions.cs
@@ -1,9 +1,9 @@
// Copyright 2005-2015 Giacomo Stelluti Scala & Contributors. All rights reserved. See License.md in the project root for license information.
+using Xunit;
+using FluentAssertions;
using CommandLine.Core;
using CommandLine.Tests.Fakes;
-using FluentAssertions;
-using Xunit;
namespace CommandLine.Tests.Unit.Infrastructure
{
diff --git a/tests/CommandLine.Tests/Unit/Core/ScalarTests.cs b/tests/CommandLine.Tests/Unit/Core/ScalarTests.cs
index 2984b77e..9b1028f0 100644
--- a/tests/CommandLine.Tests/Unit/Core/ScalarTests.cs
+++ b/tests/CommandLine.Tests/Unit/Core/ScalarTests.cs
@@ -1,10 +1,10 @@
// Copyright 2005-2015 Giacomo Stelluti Scala & Contributors. All rights reserved. See License.md in the project root for license information.
using System.Linq;
-using CommandLine.Core;
-using CSharpx;
using Xunit;
using FluentAssertions;
+using CSharpx;
+using CommandLine.Core;
namespace CommandLine.Tests.Unit.Core
{
diff --git a/tests/CommandLine.Tests/Unit/Core/SequenceTests.cs b/tests/CommandLine.Tests/Unit/Core/SequenceTests.cs
index 36e3e262..b26575b8 100644
--- a/tests/CommandLine.Tests/Unit/Core/SequenceTests.cs
+++ b/tests/CommandLine.Tests/Unit/Core/SequenceTests.cs
@@ -1,10 +1,10 @@
// Copyright 2005-2015 Giacomo Stelluti Scala & Contributors. All rights reserved. See License.md in the project root for license information.
using System.Linq;
-using CommandLine.Core;
-using CSharpx;
using Xunit;
using FluentAssertions;
+using CSharpx;
+using CommandLine.Core;
namespace CommandLine.Tests.Unit.Core
{
diff --git a/tests/CommandLine.Tests/Unit/Core/SwitchTests.cs b/tests/CommandLine.Tests/Unit/Core/SwitchTests.cs
index a4163990..82edb635 100644
--- a/tests/CommandLine.Tests/Unit/Core/SwitchTests.cs
+++ b/tests/CommandLine.Tests/Unit/Core/SwitchTests.cs
@@ -1,10 +1,10 @@
// Copyright 2005-2015 Giacomo Stelluti Scala & Contributors. All rights reserved. See License.md in the project root for license information.
using System.Linq;
-using CommandLine.Core;
-using CSharpx;
using Xunit;
using FluentAssertions;
+using CSharpx;
+using CommandLine.Core;
namespace CommandLine.Tests.Unit.Core
{
diff --git a/tests/CommandLine.Tests/Unit/Core/TextWrapperTests.cs b/tests/CommandLine.Tests/Unit/Core/TextWrapperTests.cs
index 1db7497e..8de39610 100644
--- a/tests/CommandLine.Tests/Unit/Core/TextWrapperTests.cs
+++ b/tests/CommandLine.Tests/Unit/Core/TextWrapperTests.cs
@@ -1,8 +1,9 @@
using System;
using System.Linq;
-using CommandLine.Text;
-using FluentAssertions;
using Xunit;
+using FluentAssertions;
+using CSharpx;
+using CommandLine.Text;
namespace CommandLine.Tests.Unit.Core
{
diff --git a/tests/CommandLine.Tests/Unit/Core/TokenPartitionerTests.cs b/tests/CommandLine.Tests/Unit/Core/TokenPartitionerTests.cs
index 11a9ffdd..20006e59 100644
--- a/tests/CommandLine.Tests/Unit/Core/TokenPartitionerTests.cs
+++ b/tests/CommandLine.Tests/Unit/Core/TokenPartitionerTests.cs
@@ -1,14 +1,11 @@
// Copyright 2005-2015 Giacomo Stelluti Scala & Contributors. All rights reserved. See License.md in the project root for license information.
-using CommandLine.Core;
-
-using CSharpx;
-
using System;
using System.Collections.Generic;
using System.Linq;
-
using Xunit;
+using CSharpx;
+using CommandLine.Core;
namespace CommandLine.Tests.Unit.Core
{
diff --git a/tests/CommandLine.Tests/Unit/Core/TokenTests.cs b/tests/CommandLine.Tests/Unit/Core/TokenTests.cs
index 991171db..1290f9b3 100644
--- a/tests/CommandLine.Tests/Unit/Core/TokenTests.cs
+++ b/tests/CommandLine.Tests/Unit/Core/TokenTests.cs
@@ -1,7 +1,7 @@
// Copyright 2005-2015 Giacomo Stelluti Scala & Contributors. All rights reserved. See License.md in the project root for license information.
-using CommandLine.Core;
using Xunit;
+using CommandLine.Core;
namespace CommandLine.Tests.Unit.Core
{
diff --git a/tests/CommandLine.Tests/Unit/Core/TokenizerTests.cs b/tests/CommandLine.Tests/Unit/Core/TokenizerTests.cs
index 3bd95891..32d79b4f 100644
--- a/tests/CommandLine.Tests/Unit/Core/TokenizerTests.cs
+++ b/tests/CommandLine.Tests/Unit/Core/TokenizerTests.cs
@@ -1,19 +1,14 @@
// Copyright 2005-2015 Giacomo Stelluti Scala & Contributors. All rights reserved. See License.md in the project root for license information.
-using CommandLine.Core;
-using CommandLine.Infrastructure;
-
-using CSharpx;
-
-using FluentAssertions;
-
-using RailwaySharp.ErrorHandling;
-
using System;
using System.Collections.Generic;
using System.Linq;
-
using Xunit;
+using FluentAssertions;
+using CSharpx;
+using RailwaySharp.ErrorHandling;
+using CommandLine.Core;
+using CommandLine.Infrastructure;
namespace CommandLine.Tests.Unit.Core
{
@@ -121,7 +116,7 @@ public void Should_return_error_if_option_format_with_equals_is_not_correct()
var result = Tokenizer.Tokenize(args, name => NameLookupResult.OtherOptionFound, token => token);
- var tokens = result.SuccessfulMessages();
+ var tokens = result.SuccessMessages();
Assert.NotNull(tokens);
Assert.Equal(2, tokens.Count());
diff --git a/tests/CommandLine.Tests/Unit/Core/TypeConverterTests.cs b/tests/CommandLine.Tests/Unit/Core/TypeConverterTests.cs
index 90fbc3f5..d9f3988c 100644
--- a/tests/CommandLine.Tests/Unit/Core/TypeConverterTests.cs
+++ b/tests/CommandLine.Tests/Unit/Core/TypeConverterTests.cs
@@ -1,10 +1,10 @@
using System;
using System.Collections.Generic;
using System.Globalization;
-using CommandLine.Core;
-using CSharpx;
-using FluentAssertions;
using Xunit;
+using FluentAssertions;
+using CSharpx;
+using CommandLine.Core;
namespace CommandLine.Tests.Unit.Core
{
diff --git a/tests/CommandLine.Tests/Unit/Issue104Tests.cs b/tests/CommandLine.Tests/Unit/Issue104Tests.cs
index fcbefedd..ca35689e 100644
--- a/tests/CommandLine.Tests/Unit/Issue104Tests.cs
+++ b/tests/CommandLine.Tests/Unit/Issue104Tests.cs
@@ -1,9 +1,8 @@
using System.Linq;
+using Xunit;
+using FluentAssertions;
using CommandLine.Tests.Fakes;
using CommandLine.Text;
-using FluentAssertions;
-using Xunit;
-using Xunit.Abstractions;
//Issue #104
//When outputting HelpText, the code will correctly list valid values for enum type options. However, if the option is a nullable enum type, then it will not list the valid values.
diff --git a/tests/CommandLine.Tests/Unit/Issue389Tests.cs b/tests/CommandLine.Tests/Unit/Issue389Tests.cs
index ef4f6169..5c81e6e0 100644
--- a/tests/CommandLine.Tests/Unit/Issue389Tests.cs
+++ b/tests/CommandLine.Tests/Unit/Issue389Tests.cs
@@ -1,9 +1,7 @@
-using CommandLine.Text;
-using System;
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.Linq;
-using System.Text;
using Xunit;
+using CommandLine.Text;
namespace CommandLine.Tests.Unit
{
diff --git a/tests/CommandLine.Tests/Unit/Issue418Tests.cs b/tests/CommandLine.Tests/Unit/Issue418Tests.cs
index 9c8678bd..cac1e9f1 100644
--- a/tests/CommandLine.Tests/Unit/Issue418Tests.cs
+++ b/tests/CommandLine.Tests/Unit/Issue418Tests.cs
@@ -1,12 +1,8 @@
-using CommandLine.Text;
using System;
using System.IO;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using CommandLine.Tests.Fakes;
-using Xunit;
using FluentAssertions;
+using Xunit;
+using CommandLine.Tests.Fakes;
namespace CommandLine.Tests.Unit
{
diff --git a/tests/CommandLine.Tests/Unit/Issue482Tests.cs b/tests/CommandLine.Tests/Unit/Issue482Tests.cs
index 61bc1f25..9d2ea971 100644
--- a/tests/CommandLine.Tests/Unit/Issue482Tests.cs
+++ b/tests/CommandLine.Tests/Unit/Issue482Tests.cs
@@ -1,16 +1,10 @@
using System;
using System.Collections.Generic;
-using System.Globalization;
-using CommandLine.Core;
using System.Linq;
-using System.Reflection;
-using CommandLine.Infrastructure;
using CommandLine.Tests.Fakes;
using CommandLine.Text;
-using FluentAssertions;
using Xunit;
-using System.Text;
-using Xunit.Sdk;
+using FluentAssertions;
namespace CommandLine.Tests.Unit
{
@@ -47,11 +41,11 @@ public void AutoBuild_without_ordering()
"--version Display version information.",
"value pos. 0"
};
- Assert.Equal(expected.Count, helps.Count);
+ expected.Count.Should().Be(helps.Count);
int i = 0;
foreach (var expect in expected)
{
- Assert.Equal(expect.Trim(), helps[i].Trim());
+ expect.Trim().Should().Be(helps[i].Trim());
i++;
}
@@ -95,11 +89,11 @@ public void AutoBuild_with_ordering()
"--version Display version information.",
"value pos. 0"
};
- Assert.Equal(expected.Count, helps.Count);
+ expected.Count.Should().Be(helps.Count);
int i = 0;
foreach (var expect in expected)
{
- Assert.Equal(expect.Trim(), helps[i].Trim());
+ expect.Trim().Should().Be(helps[i].Trim());
i++;
}
@@ -178,11 +172,11 @@ public void AutoBuild_with_ordering_on_shortName()
"--version Display version information.",
"value pos. 0"
};
- Assert.Equal(expected.Count, helps.Count);
+ expected.Count.Should().Be(helps.Count);
int i = 0;
foreach (var expect in expected)
{
- Assert.Equal(expect.Trim(), helps[i].Trim());
+ expect.Trim().Should().Be(helps[i].Trim());
i++;
}
}
diff --git a/tests/CommandLine.Tests/Unit/ParserResultExtensionsTests.cs b/tests/CommandLine.Tests/Unit/ParserResultExtensionsTests.cs
index 97755940..178483ed 100644
--- a/tests/CommandLine.Tests/Unit/ParserResultExtensionsTests.cs
+++ b/tests/CommandLine.Tests/Unit/ParserResultExtensionsTests.cs
@@ -1,11 +1,9 @@
// Copyright 2005-2015 Giacomo Stelluti Scala & Contributors. All rights reserved. See License.md in the project root for license information.
-using System;
-using System.Collections.Generic;
using System.Linq;
-using CommandLine.Tests.Fakes;
using Xunit;
using FluentAssertions;
+using CommandLine.Tests.Fakes;
namespace CommandLine.Tests.Unit
{
diff --git a/tests/CommandLine.Tests/Unit/ParserSettingsTests.cs b/tests/CommandLine.Tests/Unit/ParserSettingsTests.cs
index 86691c8f..c8da9063 100644
--- a/tests/CommandLine.Tests/Unit/ParserSettingsTests.cs
+++ b/tests/CommandLine.Tests/Unit/ParserSettingsTests.cs
@@ -1,11 +1,6 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using FluentAssertions;
+using System.IO;
using Xunit;
+using FluentAssertions;
namespace CommandLine.Tests.Unit
{
diff --git a/tests/CommandLine.Tests/Unit/ParserTests.cs b/tests/CommandLine.Tests/Unit/ParserTests.cs
index af5a6eec..fc2ae150 100644
--- a/tests/CommandLine.Tests/Unit/ParserTests.cs
+++ b/tests/CommandLine.Tests/Unit/ParserTests.cs
@@ -2,13 +2,12 @@
using System;
using System.Collections.Generic;
-using System.Diagnostics;
using System.IO;
using System.Linq;
-using CommandLine.Tests.Fakes;
-using FluentAssertions;
using Xunit;
+using FluentAssertions;
using CommandLine.Text;
+using CommandLine.Tests.Fakes;
namespace CommandLine.Tests.Unit
{
diff --git a/tests/CommandLine.Tests/Unit/StringBuilderExtensionsTests.cs b/tests/CommandLine.Tests/Unit/StringBuilderExtensionsTests.cs
index 8fe73a60..fdbd6526 100644
--- a/tests/CommandLine.Tests/Unit/StringBuilderExtensionsTests.cs
+++ b/tests/CommandLine.Tests/Unit/StringBuilderExtensionsTests.cs
@@ -1,8 +1,5 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
+using System.Collections.Generic;
using System.Text;
-using System.Threading.Tasks;
using Xunit;
using FluentAssertions;
using CommandLine.Infrastructure;
diff --git a/tests/CommandLine.Tests/Unit/Text/HelpTextAutoBuildFix.cs b/tests/CommandLine.Tests/Unit/Text/HelpTextAutoBuildFix.cs
index 4b78aa13..d777c8f9 100644
--- a/tests/CommandLine.Tests/Unit/Text/HelpTextAutoBuildFix.cs
+++ b/tests/CommandLine.Tests/Unit/Text/HelpTextAutoBuildFix.cs
@@ -1,17 +1,16 @@
using System;
using System.Linq;
+using Xunit;
+using FluentAssertions;
using CommandLine.Tests.Fakes;
using CommandLine.Text;
-using FluentAssertions;
-using Xunit;
namespace CommandLine.Tests.Unit.Text
{
public class HelpTextAutoBuildFix
{
-
[Fact]
- public void HelpText_wit_AdditionalNewLineAfterOption_true_should_have_newline()
+ public void HelpText_with_AdditionalNewLineAfterOption_true_should_have_newline()
{
// Fixture setup
// Exercize system
@@ -36,7 +35,7 @@ public void HelpText_wit_AdditionalNewLineAfterOption_true_should_have_newline()
}
[Fact]
- public void HelpText_wit_AdditionalNewLineAfterOption_false_should_not_have_newline()
+ public void HelpText_with_AdditionalNewLineAfterOption_false_should_not_have_newline()
{
// Fixture setup
// Exercize system
@@ -55,7 +54,7 @@ public void HelpText_wit_AdditionalNewLineAfterOption_false_should_not_have_newl
// Teardown
}
[Fact]
- public void HelpText_wit_by_default_should_include_help_version_option()
+ public void HelpText_with_by_default_should_include_help_version_option()
{
// Fixture setup
// Exercize system
@@ -73,7 +72,7 @@ public void HelpText_wit_by_default_should_include_help_version_option()
}
[Fact]
- public void HelpText_wit_AutoHelp_false_should_hide_help_option()
+ public void HelpText_with_AutoHelp_false_should_hide_help_option()
{
// Fixture setup
// Exercize system
diff --git a/tests/CommandLine.Tests/Unit/Text/HelpTextTests.cs b/tests/CommandLine.Tests/Unit/Text/HelpTextTests.cs
index dde64dc8..9811f7be 100644
--- a/tests/CommandLine.Tests/Unit/Text/HelpTextTests.cs
+++ b/tests/CommandLine.Tests/Unit/Text/HelpTextTests.cs
@@ -6,16 +6,13 @@
using System.Linq;
using System.Reflection;
using System.Text;
-
+using Xunit;
+using FluentAssertions;
using CommandLine.Core;
using CommandLine.Infrastructure;
using CommandLine.Tests.Fakes;
using CommandLine.Text;
-using FluentAssertions;
-
-using Xunit;
-
namespace CommandLine.Tests.Unit.Text
{
public class HelpTextTests : IDisposable
diff --git a/tests/CommandLine.Tests/Unit/UnParserExtensionsTests.cs b/tests/CommandLine.Tests/Unit/UnParserExtensionsTests.cs
index 90cb8929..255b2c05 100644
--- a/tests/CommandLine.Tests/Unit/UnParserExtensionsTests.cs
+++ b/tests/CommandLine.Tests/Unit/UnParserExtensionsTests.cs
@@ -3,11 +3,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using System.Text.RegularExpressions;
using CommandLine.Tests.Fakes;
using Xunit;
using FluentAssertions;
+#if !SKIP_FSHARP
using Microsoft.FSharp.Core;
+#endif
namespace CommandLine.Tests.Unit
{
diff --git a/tests/CommandLine.Tests/Unit/VerbAttributeTests.cs b/tests/CommandLine.Tests/Unit/VerbAttributeTests.cs
index 4dc1dd30..386e3015 100644
--- a/tests/CommandLine.Tests/Unit/VerbAttributeTests.cs
+++ b/tests/CommandLine.Tests/Unit/VerbAttributeTests.cs
@@ -4,7 +4,7 @@
namespace CommandLine.Tests
{
//Test localization of VerbAttribute
- public class VerbAttributeTests
+ public class VerbAttributeTests
{
[Theory]
[InlineData("", null, "")]
@@ -22,6 +22,7 @@ public static void VerbHelpText(string helpText, Type resourceType, string expec
Assert.Equal(expected, verbAttribute.HelpText);
}
+
[Theory]
[InlineData("HelpText", typeof(Fakes.NonStaticResource_WithNonStaticProperty))]
[InlineData("WriteOnlyText", typeof(Fakes.NonStaticResource))]