@@ -526,173 +526,6 @@ let toTaskResult v =
526526 |> Task.FromResult
527527#endif
528528
529- let ``AsyncResultCE applicative tests`` =
530- testList " AsyncResultCE applicative tests" [
531- testCaseAsync " Happy Path AsyncResult"
532- <| async {
533- let! actual =
534- asyncResult {
535- let! a = AsyncResult.retn 3
536- and! b = AsyncResult.retn 2
537- and! c = AsyncResult.retn 1
538- return a + b - c
539- }
540-
541- Expect.equal actual ( Ok 4 ) " Should be ok"
542- }
543-
544- #if ! FABLE_ COMPILER
545-
546- testCaseAsync " Happy Path TaskResult"
547- <| async {
548- let! actual =
549- asyncResult {
550- let! a = toTaskResult 3
551- and! b = toTaskResult 2
552- and! c = toTaskResult 1
553- return a + b - c
554- }
555-
556- Expect.equal actual ( Ok 4 ) " Should be ok"
557- }
558-
559- #endif
560-
561- testCaseAsync " Happy Path Result"
562- <| async {
563- let! actual =
564- asyncResult {
565- let! a = Result.Ok 3
566- and! b = Result.Ok 2
567- and! c = Result.Ok 1
568- return a + b - c
569- }
570-
571- Expect.equal actual ( Ok 4 ) " Should be ok"
572- }
573-
574- testCaseAsync " Happy Path Choice"
575- <| async {
576- let! actual =
577- asyncResult {
578- let! a = Choice1Of2 3
579- and! b = Choice1Of2 2
580- and! c = Choice1Of2 1
581- return a + b - c
582- }
583-
584- Expect.equal actual ( Ok 4 ) " Should be ok"
585- }
586-
587- // Cannot get this to compile properly
588- testCaseAsync " Happy Path Async"
589- <| async {
590- let! actual =
591- asyncResult {
592- let! a = Async.singleton 3 //: Async<int>
593- and! b = Async.singleton 2 //: Async<int>
594- and! c = Async.singleton 1 //: Async<int>
595- return a + b - c
596- }
597-
598- Expect.equal actual ( Ok 4 ) " Should be ok"
599- }
600-
601- testCaseAsync " Happy Path 2 Async"
602- <| async {
603- let! actual =
604- asyncResult {
605- let! a = Async.singleton 3 //: Async<int>
606- and! b = Async.singleton 2 //: Async<int>
607- return a + b
608- }
609-
610- Expect.equal actual ( Ok 5 ) " Should be ok"
611- }
612-
613- #if ! FABLE_ COMPILER
614-
615- testCaseAsync " Happy Path 2 Task"
616- <| async {
617- let! actual =
618- asyncResult {
619- let! a = Task.FromResult 3
620- and! b = Task.FromResult 2
621- return a + b
622- }
623-
624- Expect.equal actual ( Ok 5 ) " Should be ok"
625- }
626-
627- #endif
628-
629- testCaseAsync " Happy Path Result/Choice/AsyncResult"
630- <| async {
631- let! actual =
632- asyncResult {
633- let! a = Ok 3
634- and! b = Choice1Of2 2
635-
636- and! c =
637- Ok 1
638- |> Async.singleton
639-
640- return a + b - c
641- }
642-
643- Expect.equal actual ( Ok 4 ) " Should be ok"
644- }
645-
646- testCaseAsync " Fail Path Result"
647- <| async {
648- let expected = Error " TryParse failure"
649-
650- let! actual =
651- asyncResult {
652- let! a = Ok 3
653- and! b = Ok 2
654- and! c = expected
655- return a + b - c
656- }
657-
658- Expect.equal actual expected " Should be Error"
659- }
660-
661- testCaseAsync " Fail Path Choice"
662- <| async {
663- let errorMsg = " TryParse failure"
664-
665- let! actual =
666- asyncResult {
667- let! a = Choice1Of2 3
668- and! b = Choice1Of2 2
669- and! c = Choice2Of2 errorMsg
670- return a + b - c
671- }
672-
673- Expect.equal actual ( Error errorMsg) " Should be Error"
674- }
675-
676- testCaseAsync " Fail Path Result/Choice/AsyncResult"
677- <| async {
678- let errorMsg = " TryParse failure"
679-
680- let! actual =
681- asyncResult {
682- let! a = Choice1Of2 3
683-
684- and! b =
685- Ok 2
686- |> Async.singleton
687-
688- and! c = Error errorMsg
689- return a + b - c
690- }
691-
692- Expect.equal actual ( Error errorMsg) " Should be Error"
693- }
694- ]
695-
696529
697530let ``AsyncResultCE Stack Trace Tests`` =
698531
@@ -769,7 +602,6 @@ let allTests =
769602 `` AsyncResultCE try Tests ``
770603 `` AsyncResultCE using Tests ``
771604 `` AsyncResultCE loop Tests ``
772- `` AsyncResultCE applicative tests ``
773605 `` AsyncResultCE Stack Trace Tests ``
774606 `` AsyncResultCE inference checks ``
775607 ]
0 commit comments