Skip to content

Commit

Permalink
Clarify a few tests by using InlineData
Browse files Browse the repository at this point in the history
  • Loading branch information
abelbraaksma committed Oct 16, 2022
1 parent e8c064d commit 6805c30
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions src/FSharpy.TaskSeq.Test/TaskSeq.Zip.Tests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,30 @@ let ``TaskSeq-zip zips different types`` () = task {
combined |> should equal [| ("one", 42L); ("two", 43L) |]
}

[<Fact>]
let ``TaskSeq-zip throws on unequal lengths`` () = task {
let one = createDummyTaskSeq 10
let two = createDummyTaskSeq 11
let combined = TaskSeq.zip one two
[<Theory; InlineData true; InlineData false>]
let ``TaskSeq-zip throws on unequal lengths, variant`` leftThrows = task {
let long = createDummyTaskSeq 11
let short = createDummyTaskSeq 10

let combined =
if leftThrows then
TaskSeq.zip short long
else
TaskSeq.zip long short

fun () -> TaskSeq.toArrayAsync combined |> Task.ignore
|> should throwAsyncExact typeof<ArgumentException>
}

[<Fact>]
let ``TaskSeq-zip throws on unequal lengths, inverted args`` () = task {
[<Theory; InlineData true; InlineData false>]
let ``TaskSeq-zip throws on unequal lengths with empty seq`` leftThrows = task {
let one = createDummyTaskSeq 1
let combined = TaskSeq.zip one TaskSeq.empty

let combined =
if leftThrows then
TaskSeq.zip TaskSeq.empty one
else
TaskSeq.zip one TaskSeq.empty

fun () -> TaskSeq.toArrayAsync combined |> Task.ignore
|> should throwAsyncExact typeof<ArgumentException>
Expand Down

0 comments on commit 6805c30

Please sign in to comment.