Skip to content

Commit ae1c910

Browse files
committed
fixup! test: cover EquatableArray in F#
1 parent 10d784b commit ae1c910

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

‎tests/FSharp.Collections.Immutable.Tests/EquatableArray/EquatableArrayModuleTests.fs‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,19 @@ type EquatableArrayModuleTests () =
5555
Assert.AreEqual (EquatableArray.ofArray [| 3; 1; 2 |], EquatableArray.ofList [ 3; 1; 2 ], "ofList must keep the order")
5656
Assert.IsTrue ((EquatableArray.ofList List.empty<int>).IsEmpty, "an empty list must give the empty array")
5757

58+
[<TestMethod>]
59+
member _.``ofList rejects null`` () =
60+
let ex =
61+
Assert.ThrowsExactly<ArgumentNullException>(
62+
(fun () ->
63+
EquatableArray.ofList Unchecked.defaultof<int list>
64+
|> ignore
65+
),
66+
"ofList must reject null, where List.toArray dereferences it"
67+
)
68+
69+
Assert.AreEqual<string | null>("list", ex.ParamName, "the exception must name the parameter")
70+
5871
[<TestMethod>]
5972
member _.``ofSeq copies a list or an array`` () =
6073
let source = [| 1; 2; 3 |]

0 commit comments

Comments
 (0)