@@ -377,6 +377,18 @@ let defaultValueTests =
377377 ]
378378
379379
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+
380392let defaultWithTests =
381393 testList " defaultWith Tests" [
382394 testCase " defaultWith returns the ok value" <| fun _ ->
@@ -565,6 +577,22 @@ let zipTests =
565577 Expect.equal actual ( Error " Bad1" ) " Should be Error"
566578 ]
567579
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+
568596let allTests = testList " Result Tests" [
569597 resultIsOk
570598 resultIsError
@@ -592,6 +620,7 @@ let allTests = testList "Result Tests" [
592620 setErrorTests
593621 withErrorTests
594622 defaultValueTests
623+ defaultErrorTests
595624 defaultWithTests
596625 ignoreErrorTests
597626 teeTests
@@ -601,4 +630,5 @@ let allTests = testList "Result Tests" [
601630 sequenceAsyncTests
602631 valueOrTests
603632 zipTests
633+ zipErrorTests
604634]
0 commit comments