@@ -961,44 +961,52 @@ module Task =
961961 [<Test>]
962962 let taskbuilderTests () =
963963 printfn " Running taskbuilder tests..."
964- try
965- testShortCircuitResult()
966- testDelay()
967- testNoDelay()
968- testNonBlocking()
969- testCatching1()
970- testCatching2()
971- testNestedCatching()
972- testTryFinallyHappyPath()
973- testTryFinallySadPath()
974- testTryFinallyCaught()
975- testUsing()
976- testUsingFromTask ()
977- testUsingSadPath()
978- testForLoop()
979- testForLoopSadPath()
980- testExceptionAttachedToTaskWithoutAwait () // *1
981- testExceptionAttachedToTaskWithAwait () // *1
982- testExceptionThrownInFinally()
983- test2ndExceptionThrownInFinally()
984- testFixedStackWhileLoop() // *2
985- testFixedStackForLoop() // *2
986- testTypeInference()
987- // testNoStackOverflowWithImmediateResult() // *3
988- testNoStackOverflowWithYieldResult()
989- // (Original note from TaskBuilder , n/a here)
964+ let tests = [
965+ testShortCircuitResult
966+ testDelay
967+ testNoDelay
968+ testNonBlocking
969+ testCatching1
970+ testCatching2
971+ testNestedCatching
972+ testTryFinallyHappyPath
973+ testTryFinallySadPath
974+ testTryFinallyCaught
975+ testUsing
976+ testUsingFromValueTask
977+ testUsingSadPath
978+ testForLoop
979+ testForLoopSadPath
980+ testExceptionAttachedToValueTaskWithoutAwait // *1
981+ testExceptionAttachedToValueTaskWithAwait // *1
982+ testExceptionThrownInFinally
983+ test2ndExceptionThrownInFinally
984+ testFixedStackWhileLoop // *2
985+ testFixedStackForLoop // *2
986+ testTypeInference
987+ // testNoStackOverflowWithImmediateResult // *3
988+ testNoStackOverflowWithYieldResult
989+ // (Original note from ValueTaskBuilder , n/a here)
990990 // we don't support TCO, so large tail recursions will stack overflow
991991 // or at least use O(n) heap. but small ones should at least function OK.
992- testSmallTailRecursion()
993- testTryOverReturnFrom()
994- testTryFinallyOverReturnFromWithException()
995- testTryFinallyOverReturnFromWithoutException()
996- // testCompatibilityWithOldUnitTask() // *4
997- testAsyncsMixedWithTasks() // *5
998- printfn " Passed all tests!"
999- with
1000- | exn ->
1001- eprintfn " Exception: %O " exn
992+ testSmallTailRecursion
993+ testTryOverReturnFrom
994+ testTryFinallyOverReturnFromWithException
995+ testTryFinallyOverReturnFromWithoutException
996+ // testCompatibilityWithOldUnitValueTask // *4
997+ testAsyncsMixedWithValueTasks // *5
998+ ]
999+
1000+ let passed , failed =
1001+ tests
1002+ |> List.map Choice.protect
1003+ |> List.partitionMap ( fun x -> x())
1004+
1005+ let failureMsg = sprintf " Some tests failed: %A " failed + ( failed |> String.concat System.Environment.NewLine ( sprintfn " Exception: %O " ))
1006+
1007+ Assert.AreEqual ( 0 , List.length failed, failureMsg)
1008+ printfn " Passed all TaskBuilder tests (%i ) !" ( List.length passed)
1009+
10021010 ()
10031011
10041012 // *1 Test adapted due to errors not being part of the workflow, this is by-design.
0 commit comments