File tree Expand file tree Collapse file tree 3 files changed +7
-8
lines changed
UniqueFileGenerator.Console
UniqueFileGenerator.Tests Expand file tree Collapse file tree 3 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ module ArgTypes =
1515 let private tryParseIntInRange ( floor , ceiling ) text =
1616 text
1717 |> parseInRange ( floor, ceiling)
18- |> Result.mapError ( fun _ -> ParseNumberFailure ( text, floor, ceiling))
18+ |> Result.mapError ( fun _ -> ParseNumberFailure ( text, ( floor, ceiling) ))
1919
2020 type FileCount = private FileCount of int with
2121 static member val AllowedRange = 1 , Int32.MaxValue
@@ -24,9 +24,8 @@ module ArgTypes =
2424 text
2525 |> stripSeparators
2626 |> parseInRange FileCount.AllowedRange
27- |> Result.mapError ( fun _ ->
28- ParseNumberFailure ( text, fst FileCount.AllowedRange, snd FileCount.AllowedRange))
2927 |> Result.map FileCount
28+ |> Result.mapError ( fun _ -> ParseNumberFailure ( text, FileCount.AllowedRange))
3029
3130 member this.Value = let ( FileCount count ) = this in count
3231
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ module Errors =
99 | MalformedFlags
1010 | UnsupportedFlags
1111 | DuplicateFlags
12- | ParseNumberFailure of Arg : string * Floor : int * Ceiling : int
12+ | ParseNumberFailure of Arg : string * AllowedRange : ( int * int )
1313 | DirectoryMissing of string
1414 | DriveSpaceConfirmationFailure
1515 | DriveSpaceInsufficient of Needed : string * Actual : string
@@ -23,7 +23,7 @@ module Errors =
2323 | MalformedFlags -> " Malformed flag(s) found."
2424 | UnsupportedFlags -> " Unsupported flag(s) found."
2525 | DuplicateFlags -> " Duplicate option flag(s) found. Each can only be used once."
26- | ParseNumberFailure ( x, f, c) ->
26+ | ParseNumberFailure ( x, ( f, c) ) ->
2727 $" Could not parse \" %s {x}\" to an integer between %s {formatInt f} and %s {formatInt c}, inclusive."
2828 | DirectoryMissing e -> $" Directory \" %s {e}\" was not found."
2929 | DriveSpaceConfirmationFailure -> " Could not confirm available drive space."
Original file line number Diff line number Diff line change @@ -64,21 +64,21 @@ let ``Appropriate error when invalid arg count (second pair incomplete)`` () =
6464[<Fact>]
6565let ``Appropriate error when invalid file count`` () =
6666 let args = [| " notNumeric" |]
67- let expected = Error <| ParseNumberFailure( args[ 0 ], 1 , Int32.MaxValue)
67+ let expected = Error ( ParseNumberFailure( args[ 0 ], ( 1 , Int32.MaxValue)) )
6868 let actual = validate args
6969 Assert.Equal( expected, actual)
7070
7171[<Fact>]
7272let ``Appropriate error when negative file count`` () =
7373 let args = [| " -1" |]
74- let expected = Error <| ParseNumberFailure( args[ 0 ], 1 , Int32.MaxValue)
74+ let expected = Error ( ParseNumberFailure( args[ 0 ], ( 1 , Int32.MaxValue)) )
7575 let actual = validate args
7676 Assert.Equal( expected, actual)
7777
7878[<Fact>]
7979let ``Appropriate error when zero file count`` () =
8080 let args = [| " 0" |]
81- let expected = Error <| ParseNumberFailure( args[ 0 ], 1 , Int32.MaxValue)
81+ let expected = Error ( ParseNumberFailure( args[ 0 ], ( 1 , Int32.MaxValue)) )
8282 let actual = validate args
8383 Assert.Equal( expected, actual)
8484
You can’t perform that action at this time.
0 commit comments