Skip to content

Commit

Permalink
Fsdk.Tests(ArgsParsing): new failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
knocte committed Aug 23, 2023
1 parent 0f59027 commit 08eeb29
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Fsdk.Tests/ArgsParsing.fs
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,22 @@ type ArgsParsing() =
Assert.That(Seq.item 0 flags, Is.EqualTo "--someLongFlag1")
Assert.That(Seq.item 1 flags, Is.EqualTo "-f2")
| _ -> Assert.Fail "res was not ArgsParsing.OnlyFlags subtype"

[<Test>]
member __.``pre and post flags``() =
let commandLine =
"someProgram --someLongPreFlag1 -f2 someNonFlagArg --someLongPostFlag3 -f4"
.Split(' ')

let res = Misc.ParseArgs commandLine

match res with
| Misc.ArgsParsed.BothFlags(preFlags, arg, postFlags) ->
Assert.That(arg, Is.EqualTo "someNonFlagArg")
Assert.That(Seq.length preFlags, Is.EqualTo 2)
Assert.That(Seq.item 0 preFlags, Is.EqualTo "--someLongPreFlag1")
Assert.That(Seq.item 1 preFlags, Is.EqualTo "-f2")
Assert.That(Seq.length postFlags, Is.EqualTo 2)
Assert.That(Seq.item 0 postFlags, Is.EqualTo "--someLongPostFlag3")
Assert.That(Seq.item 1 postFlags, Is.EqualTo "-f4")
| _ -> Assert.Fail "res was not ArgsParsing.BothFlags subtype"

0 comments on commit 08eeb29

Please sign in to comment.