Skip to content

Commit

Permalink
Fsdk,Fsdk.Tests: add new ArgsParsing failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
knocte committed Aug 23, 2023
1 parent 3a0f522 commit 32b0c39
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Fsdk.Tests/ArgsParsing.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
namespace Fsdk.Tests

open NUnit.Framework

open Fsdk

[<TestFixture>]
type ArgsParsing() =

[<Test>]
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"
1 change: 1 addition & 0 deletions Fsdk.Tests/Fsdk.Tests-legacy.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="ArgsParsing.fs" />
<Compile Include="FSharpUtil.fs" />
<Compile Include="AsyncExtensions.fs" />
<Compile Include="Tsv.fs" />
Expand Down
1 change: 1 addition & 0 deletions Fsdk.Tests/Fsdk.Tests.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
</PropertyGroup>

<ItemGroup>
<Compile Include="ArgsParsing.fs" />
<Compile Include="FSharpUtil.fs" />
<Compile Include="AsyncExtensions.fs" />
<Compile Include="AsyncCancellation.fs" />
Expand Down
7 changes: 7 additions & 0 deletions Fsdk/Misc.fs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,13 @@ module Misc =
args
#endif

type ArgsParsed =
| OnlyFlags of seq<string>
| BothFlags of seq<string>*string*seq<string>

let ParseArgs (_args: array<string>): ArgsParsed =
failwith "NIE"

let FsxOnlyArguments() =
let cmdLineArgs = Environment.GetCommandLineArgs() |> List.ofSeq
#if !LEGACY_FRAMEWORK
Expand Down

0 comments on commit 32b0c39

Please sign in to comment.