diff --git a/Fsdk.Tests/ArgsParsing.fs b/Fsdk.Tests/ArgsParsing.fs new file mode 100644 index 0000000..3bbee9c --- /dev/null +++ b/Fsdk.Tests/ArgsParsing.fs @@ -0,0 +1,18 @@ +namespace Fsdk.Tests + +open NUnit.Framework + +open Fsdk + +[] +type ArgsParsing() = + + [] + member __.``simplest flags usage``() = + let commandLine = "someProgram --someLongFlag1 -f2".Split(' ') + let res: Misc.ArgsParsed = Misc.ParseArgs commandLine + + match res with + | Misc.ArgsParsed.OnlyFlags flags -> + Assert.That(Seq.length flags, Is.EqualTo 2) + | _ -> Assert.Fail "res was not ArgsParsing.OnlyFlags subtype" diff --git a/Fsdk.Tests/Fsdk.Tests-legacy.fsproj b/Fsdk.Tests/Fsdk.Tests-legacy.fsproj index 33ebcd3..e192b14 100644 --- a/Fsdk.Tests/Fsdk.Tests-legacy.fsproj +++ b/Fsdk.Tests/Fsdk.Tests-legacy.fsproj @@ -46,6 +46,7 @@ + diff --git a/Fsdk.Tests/Fsdk.Tests.fsproj b/Fsdk.Tests/Fsdk.Tests.fsproj index 3e9ab5c..8788426 100644 --- a/Fsdk.Tests/Fsdk.Tests.fsproj +++ b/Fsdk.Tests/Fsdk.Tests.fsproj @@ -8,6 +8,7 @@ + diff --git a/Fsdk/Misc.fs b/Fsdk/Misc.fs index 174a9e7..36a4d7d 100644 --- a/Fsdk/Misc.fs +++ b/Fsdk/Misc.fs @@ -94,6 +94,13 @@ module Misc = args #endif + type ArgsParsed = + | OnlyFlags of seq + | BothFlags of seq*string*seq + + let ParseArgs (_args: array): ArgsParsed = + failwith "NIE" + let FsxOnlyArguments() = let cmdLineArgs = Environment.GetCommandLineArgs() |> List.ofSeq #if !LEGACY_FRAMEWORK