@@ -912,44 +912,52 @@ module ValueTask =
912912 [<Test>]
913913 let taskbuilderTests () =
914914 printfn " Running taskbuilder tests..."
915- try
916- testShortCircuitResult()
917- testDelay()
918- testNoDelay()
919- testNonBlocking()
920- testCatching1()
921- testCatching2()
922- testNestedCatching()
923- testTryFinallyHappyPath()
924- testTryFinallySadPath()
925- testTryFinallyCaught()
926- testUsing()
927- testUsingFromValueTask()
928- testUsingSadPath()
929- testForLoop()
930- testForLoopSadPath()
931- testExceptionAttachedToValueTaskWithoutAwait() // *1
932- testExceptionAttachedToValueTaskWithAwait() // *1
933- testExceptionThrownInFinally()
934- test2ndExceptionThrownInFinally()
935- testFixedStackWhileLoop() // *2
936- testFixedStackForLoop() // *2
937- testTypeInference()
938- // testNoStackOverflowWithImmediateResult() // *3
939- testNoStackOverflowWithYieldResult()
915+ let tests = [
916+ testShortCircuitResult
917+ testDelay
918+ testNoDelay
919+ testNonBlocking
920+ testCatching1
921+ testCatching2
922+ testNestedCatching
923+ testTryFinallyHappyPath
924+ testTryFinallySadPath
925+ testTryFinallyCaught
926+ testUsing
927+ testUsingFromValueTask
928+ testUsingSadPath
929+ testForLoop
930+ testForLoopSadPath
931+ testExceptionAttachedToValueTaskWithoutAwait // *1
932+ testExceptionAttachedToValueTaskWithAwait // *1
933+ testExceptionThrownInFinally
934+ test2ndExceptionThrownInFinally
935+ testFixedStackWhileLoop // *2
936+ testFixedStackForLoop // *2
937+ testTypeInference
938+ // testNoStackOverflowWithImmediateResult // *3
939+ testNoStackOverflowWithYieldResult
940940 // (Original note from ValueTaskBuilder, n/a here)
941941 // we don't support TCO, so large tail recursions will stack overflow
942942 // or at least use O(n) heap. but small ones should at least function OK.
943- testSmallTailRecursion()
944- testTryOverReturnFrom()
945- testTryFinallyOverReturnFromWithException()
946- testTryFinallyOverReturnFromWithoutException()
947- // testCompatibilityWithOldUnitValueTask() // *4
948- testAsyncsMixedWithValueTasks() // *5
949- printfn " Passed all tests!"
950- with
951- | exn ->
952- eprintfn " Exception: %O " exn
943+ testSmallTailRecursion
944+ testTryOverReturnFrom
945+ testTryFinallyOverReturnFromWithException
946+ testTryFinallyOverReturnFromWithoutException
947+ // testCompatibilityWithOldUnitValueTask // *4
948+ testAsyncsMixedWithValueTasks // *5
949+ ]
950+
951+ let passed , failed =
952+ tests
953+ |> List.map Choice.protect
954+ |> List.partitionMap ( fun x -> x())
955+
956+ let failureMsg = sprintf " Some tests failed: %A " failed + ( failed |> String.concat System.Environment.NewLine ( sprintfn " Exception: %O " ))
957+
958+ Assert.AreEqual ( 0 , List.length failed, failureMsg)
959+ printfn " Passed all TaskBuilder tests (%i ) !" ( List.length passed)
960+
953961 ()
954962
955963 // *1 Test adapted due to errors not being part of the workflow, this is by-design.
0 commit comments