@@ -377,6 +377,18 @@ let defaultValueTests =
377
377
]
378
378
379
379
380
+ let defaultErrorTests =
381
+ testList " defaultError Tests" [
382
+ testCase " defaultError returns the error value" <| fun _ ->
383
+ let v = Result.defaultError 43 ( Error 42 )
384
+ Expect.equal v 42 " "
385
+
386
+ testCase " defaultError returns the given value for Ok" <| fun _ ->
387
+ let v = Result.defaultError 43 ( Ok 42 )
388
+ Expect.equal v 43 " "
389
+ ]
390
+
391
+
380
392
let defaultWithTests =
381
393
testList " defaultWith Tests" [
382
394
testCase " defaultWith returns the ok value" <| fun _ ->
@@ -565,6 +577,22 @@ let zipTests =
565
577
Expect.equal actual ( Error " Bad1" ) " Should be Error"
566
578
]
567
579
580
+ let zipErrorTests =
581
+ testList " zipError tests" [
582
+ testCase " Ok, Ok" <| fun () ->
583
+ let actual = Result.zipError ( Ok 1 ) ( Ok 2 )
584
+ Expect.equal actual ( Ok ( 1 )) " Should be ok"
585
+ testCase " Ok, Error" <| fun () ->
586
+ let actual = Result.zipError ( Ok 1 ) ( Error " Bad" )
587
+ Expect.equal actual ( Ok 1 ) " Should be ok"
588
+ testCase " Error, Ok" <| fun () ->
589
+ let actual = Result.zipError ( Error " Bad" ) ( Ok 1 )
590
+ Expect.equal actual ( Ok 1 ) " Should be ok"
591
+ testCase " Error, Error" <| fun () ->
592
+ let actual = Result.zipError ( Error " Bad1" ) ( Error " Bad2" )
593
+ Expect.equal actual ( Error ( " Bad1" , " Bad2" )) " Should be Error"
594
+ ]
595
+
568
596
let allTests = testList " Result Tests" [
569
597
resultIsOk
570
598
resultIsError
@@ -592,6 +620,7 @@ let allTests = testList "Result Tests" [
592
620
setErrorTests
593
621
withErrorTests
594
622
defaultValueTests
623
+ defaultErrorTests
595
624
defaultWithTests
596
625
ignoreErrorTests
597
626
teeTests
@@ -601,4 +630,5 @@ let allTests = testList "Result Tests" [
601
630
sequenceAsyncTests
602
631
valueOrTests
603
632
zipTests
633
+ zipErrorTests
604
634
]
0 commit comments