Skip to content

Commit

Permalink
add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
eiriktsarpalis committed Jun 29, 2016
1 parent 59d44ce commit 927b278
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tests/Argu.Tests/Tests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
open System
open System.IO
open Xunit
open FSharp.Quotations
open Swensen.Unquote.Assertions

open Argu
Expand Down Expand Up @@ -184,7 +185,7 @@ module ``Argu Tests`` =
let bytes = [|1uy .. 255uy|]
let args = parser.PrintCommandLineArguments [ Mandatory_Arg false ; Data(42, bytes) ]
let results = parser.ParseCommandLine args
test <@ results.GetResult <@ Data @> |> snd = bytes @>
test <@ let _,bytes' = results.GetResult <@ Data @> in bytes' = bytes @>

[<Fact>]
let ``Parse equals assignment`` () =
Expand Down Expand Up @@ -290,11 +291,16 @@ module ``Argu Tests`` =
test <@ result.GetResult <@ List @> = [1 .. 5] @>

[<Fact>]
let ``Get all subcommands`` () =
let ``Get all subcommand parsers`` () =
let subcommands = parser.GetSubCommandParsers()
test <@ subcommands.Length = 2 @>
test <@ subcommands |> List.forall (fun sc -> sc.IsSubCommandParser) @>

[<Fact>]
let ``Get specific subcommand parser`` () =
let subcommand = parser.GetSubCommandParser <@ Push @>
test <@ subcommand.IsSubCommandParser @>


type ConflictingCliNames =
| [<CustomCommandLine "foo">] Foo of int
Expand Down

0 comments on commit 927b278

Please sign in to comment.