diff --git a/FsToolkit.ErrorHandling.sln b/FsToolkit.ErrorHandling.sln
index f014a5d9..251c4257 100644
--- a/FsToolkit.ErrorHandling.sln
+++ b/FsToolkit.ErrorHandling.sln
@@ -11,8 +11,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{D8B86171
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FsToolkit.ErrorHandling.Tests", "tests\FsToolkit.ErrorHandling.Tests\FsToolkit.ErrorHandling.Tests.fsproj", "{F646F4E8-EA06-4EA8-9CD3-79778B264320}"
EndProject
-Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FsToolkit.ErrorHandling.TaskResult.Tests", "tests\FsToolkit.ErrorHandling.TaskResult.Tests\FsToolkit.ErrorHandling.TaskResult.Tests.fsproj", "{868CA980-5903-480E-8360-C51F5EC83275}"
-EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FsToolkit.ErrorHandling.JobResult", "src\FsToolkit.ErrorHandling.JobResult\FsToolkit.ErrorHandling.JobResult.fsproj", "{5B1EA296-538E-40E5-BF1D-6CB0F20BB52E}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FsToolkit.ErrorHandling.JobResult.Tests", "tests\FsToolkit.ErrorHandling.JobResult.Tests\FsToolkit.ErrorHandling.JobResult.Tests.fsproj", "{7DABAB8F-4A02-4992-A3A2-6C550F98C13B}"
@@ -70,18 +68,6 @@ Global
{F646F4E8-EA06-4EA8-9CD3-79778B264320}.Release|x64.Build.0 = Release|Any CPU
{F646F4E8-EA06-4EA8-9CD3-79778B264320}.Release|x86.ActiveCfg = Release|Any CPU
{F646F4E8-EA06-4EA8-9CD3-79778B264320}.Release|x86.Build.0 = Release|Any CPU
- {868CA980-5903-480E-8360-C51F5EC83275}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {868CA980-5903-480E-8360-C51F5EC83275}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {868CA980-5903-480E-8360-C51F5EC83275}.Debug|x64.ActiveCfg = Debug|Any CPU
- {868CA980-5903-480E-8360-C51F5EC83275}.Debug|x64.Build.0 = Debug|Any CPU
- {868CA980-5903-480E-8360-C51F5EC83275}.Debug|x86.ActiveCfg = Debug|Any CPU
- {868CA980-5903-480E-8360-C51F5EC83275}.Debug|x86.Build.0 = Debug|Any CPU
- {868CA980-5903-480E-8360-C51F5EC83275}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {868CA980-5903-480E-8360-C51F5EC83275}.Release|Any CPU.Build.0 = Release|Any CPU
- {868CA980-5903-480E-8360-C51F5EC83275}.Release|x64.ActiveCfg = Release|Any CPU
- {868CA980-5903-480E-8360-C51F5EC83275}.Release|x64.Build.0 = Release|Any CPU
- {868CA980-5903-480E-8360-C51F5EC83275}.Release|x86.ActiveCfg = Release|Any CPU
- {868CA980-5903-480E-8360-C51F5EC83275}.Release|x86.Build.0 = Release|Any CPU
{5B1EA296-538E-40E5-BF1D-6CB0F20BB52E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5B1EA296-538E-40E5-BF1D-6CB0F20BB52E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5B1EA296-538E-40E5-BF1D-6CB0F20BB52E}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -206,7 +192,6 @@ Global
GlobalSection(NestedProjects) = preSolution
{E0466000-F8E4-416B-B605-C65F7602367A} = {E28025A7-EF6A-45BF-8FA0-75E394D3D42B}
{F646F4E8-EA06-4EA8-9CD3-79778B264320} = {D8B86171-2147-49EF-8ADA-1CF8B0A20D40}
- {868CA980-5903-480E-8360-C51F5EC83275} = {D8B86171-2147-49EF-8ADA-1CF8B0A20D40}
{5B1EA296-538E-40E5-BF1D-6CB0F20BB52E} = {E28025A7-EF6A-45BF-8FA0-75E394D3D42B}
{7DABAB8F-4A02-4992-A3A2-6C550F98C13B} = {D8B86171-2147-49EF-8ADA-1CF8B0A20D40}
{600EA6E9-C9F2-4F02-99EF-1F992711DB1C} = {9F888E39-5D40-4E29-9529-67C466722431}
diff --git a/tests/FsToolkit.ErrorHandling.IcedTasks.Tests/FsToolkit.ErrorHandling.IcedTasks.Tests.fsproj b/tests/FsToolkit.ErrorHandling.IcedTasks.Tests/FsToolkit.ErrorHandling.IcedTasks.Tests.fsproj
index 0b5cb6e1..186c5b25 100644
--- a/tests/FsToolkit.ErrorHandling.IcedTasks.Tests/FsToolkit.ErrorHandling.IcedTasks.Tests.fsproj
+++ b/tests/FsToolkit.ErrorHandling.IcedTasks.Tests/FsToolkit.ErrorHandling.IcedTasks.Tests.fsproj
@@ -9,7 +9,7 @@
-
+
diff --git a/tests/FsToolkit.ErrorHandling.TaskResult.Tests/AssemblyInfo.fs b/tests/FsToolkit.ErrorHandling.TaskResult.Tests/AssemblyInfo.fs
deleted file mode 100644
index 92ea53b8..00000000
--- a/tests/FsToolkit.ErrorHandling.TaskResult.Tests/AssemblyInfo.fs
+++ /dev/null
@@ -1,19 +0,0 @@
-// Auto-Generated by FAKE; do not edit
-namespace System
-open System.Reflection
-
-[]
-[]
-[]
-[]
-[]
-[]
-do ()
-
-module internal AssemblyVersionInformation =
- let [] AssemblyTitle = "FsToolkit.ErrorHandling.TaskResult.Tests"
- let [] AssemblyProduct = "FsToolkit.ErrorHandling"
- let [] AssemblyDescription = "FsToolkit.ErrorHandling is a utility library to work with the Result type in F#, and allows you to do clear, simple and powerful error handling."
- let [] AssemblyVersion = "5.0.0"
- let [] AssemblyFileVersion = "5.0.0"
- let [] AssemblyConfiguration = "Release"
diff --git a/tests/FsToolkit.ErrorHandling.TaskResult.Tests/FsToolkit.ErrorHandling.TaskResult.Tests.fsproj b/tests/FsToolkit.ErrorHandling.TaskResult.Tests/FsToolkit.ErrorHandling.TaskResult.Tests.fsproj
deleted file mode 100644
index 9e2b6da2..00000000
--- a/tests/FsToolkit.ErrorHandling.TaskResult.Tests/FsToolkit.ErrorHandling.TaskResult.Tests.fsproj
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
- net8.0;net9.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/FsToolkit.ErrorHandling.TaskResult.Tests/List.fs b/tests/FsToolkit.ErrorHandling.TaskResult.Tests/List.fs
deleted file mode 100644
index 1f582dac..00000000
--- a/tests/FsToolkit.ErrorHandling.TaskResult.Tests/List.fs
+++ /dev/null
@@ -1,172 +0,0 @@
-module ListTests
-
-open Expecto
-open SampleDomain
-open TestData
-open TestHelpers
-open System
-open FsToolkit.ErrorHandling
-
-let userId1 = Guid.NewGuid()
-let userId2 = Guid.NewGuid()
-let userId3 = Guid.NewGuid()
-let userId4 = Guid.NewGuid()
-
-let notifyNewPostSuccess x =
- notifyNewPostSuccess x
- >> Async.StartImmediateAsTask
-
-let notifyNewPostFailure x =
- notifyNewPostFailure x
- >> Async.StartImmediateAsTask
-
-[]
-let traverseTaskResultMTests =
-
- let userIds =
- List.map UserId [
- userId1
- userId2
- userId3
- ]
-
- testList "List.traverseTaskResultM Tests" [
- testCase "traverseTaskResultM with a list of valid data"
- <| fun _ ->
- let expected =
- userIds
- |> List.map (fun (UserId user) -> (newPostId, user))
-
- let actual =
- List.traverseTaskResultM (notifyNewPostSuccess (PostId newPostId)) userIds
-
- Expect.hasTaskOkValueSync expected actual
-
- testCase "traverseResultA with few invalid data"
- <| fun _ ->
- let expected = sprintf "error: %s" (userId1.ToString())
-
- let actual =
- List.traverseTaskResultM (notifyNewPostFailure (PostId newPostId)) userIds
-
- Expect.hasTaskErrorValueSync expected actual
- ]
-
-let notifyFailure (PostId _) (UserId uId) =
- task {
- if
- (uId = userId1
- || uId = userId3)
- then
- return
- sprintf "error: %s" (uId.ToString())
- |> Error
- else
- return Ok()
- }
-
-
-[]
-let traverseTaskResultATests =
- let userIds =
- List.map UserId [
- userId1
- userId2
- userId3
- userId4
- ]
-
- testList "List.traverseTaskResultA Tests" [
- testCase "traverseTaskResultA with a list of valid data"
- <| fun _ ->
- let expected =
- userIds
- |> List.map (fun (UserId user) -> (newPostId, user))
-
- let actual =
- List.traverseTaskResultA (notifyNewPostSuccess (PostId newPostId)) userIds
-
- Expect.hasTaskOkValueSync expected actual
-
- testCase "traverseResultA with few invalid data"
- <| fun _ ->
- let expected = [
- sprintf "error: %s" (userId1.ToString())
- sprintf "error: %s" (userId3.ToString())
- ]
-
- let actual = List.traverseTaskResultA (notifyFailure (PostId newPostId)) userIds
-
- Expect.hasTaskErrorValueSync expected actual
- ]
-
-[]
-let sequenceTaskResultMTests =
- let userIds =
- List.map UserId [
- userId1
- userId2
- userId3
- userId4
- ]
-
- testList "List.sequenceTaskResultM Tests" [
- testCase "sequenceTaskResultM with a list of valid data"
- <| fun _ ->
- let expected =
- userIds
- |> List.map (fun (UserId user) -> (newPostId, user))
-
- let actual =
- List.map (notifyNewPostSuccess (PostId newPostId)) userIds
- |> List.sequenceTaskResultM
-
- Expect.hasTaskOkValueSync expected actual
-
- testCase "sequenceTaskResultM with few invalid data"
- <| fun _ ->
- let expected = sprintf "error: %s" (userId1.ToString())
-
- let actual =
- List.map (notifyFailure (PostId newPostId)) userIds
- |> List.sequenceTaskResultM
-
- Expect.hasTaskErrorValueSync expected actual
- ]
-
-[]
-let sequenceTaskResultATests =
- let userIds =
- List.map UserId [
- userId1
- userId2
- userId3
- userId4
- ]
-
- testList "List.sequenceTaskResultA Tests" [
- testCase "sequenceTaskResultA with a list of valid data"
- <| fun _ ->
- let expected =
- userIds
- |> List.map (fun (UserId user) -> (newPostId, user))
-
- let actual =
- List.map (notifyNewPostSuccess (PostId newPostId)) userIds
- |> List.sequenceTaskResultA
-
- Expect.hasTaskOkValueSync expected actual
-
- testCase "sequenceTaskResultA with few invalid data"
- <| fun _ ->
- let expected = [
- sprintf "error: %s" (userId1.ToString())
- sprintf "error: %s" (userId3.ToString())
- ]
-
- let actual =
- List.map (notifyFailure (PostId newPostId)) userIds
- |> List.sequenceTaskResultA
-
- Expect.hasTaskErrorValueSync expected actual
- ]
diff --git a/tests/FsToolkit.ErrorHandling.TaskResult.Tests/Main.fs b/tests/FsToolkit.ErrorHandling.TaskResult.Tests/Main.fs
deleted file mode 100644
index a71f972e..00000000
--- a/tests/FsToolkit.ErrorHandling.TaskResult.Tests/Main.fs
+++ /dev/null
@@ -1,7 +0,0 @@
-module FsToolkit.ErrorHandling.TaskResult.Tests
-
-open Expecto
-
-[]
-let main argv =
- Tests.runTestsInAssemblyWithCLIArgs [] argv
diff --git a/tests/FsToolkit.ErrorHandling.TaskResult.Tests/Result.fs b/tests/FsToolkit.ErrorHandling.TaskResult.Tests/Result.fs
deleted file mode 100644
index 1a1bbc59..00000000
--- a/tests/FsToolkit.ErrorHandling.TaskResult.Tests/Result.fs
+++ /dev/null
@@ -1,33 +0,0 @@
-module Result
-
-open Expecto
-open FsToolkit.ErrorHandling
-
-
-[]
-let sequenceTaskTests =
- testList "sequenceTask Tests" [
- testCase "sequenceTask returns the task value if Ok"
- <| fun _ ->
- let resTask =
- task { return "foo" }
- |> Ok
-
- let value =
- (resTask
- |> Result.sequenceTask)
- .Result
-
- Expect.equal value (Ok "foo") ""
-
- testCase "sequenceTask returns the error value if Error"
- <| fun _ ->
- let resTask = Error "foo"
-
- let value =
- (resTask
- |> Result.sequenceTask)
- .Result
-
- Expect.equal value (Error "foo") ""
- ]
diff --git a/tests/FsToolkit.ErrorHandling.TaskResult.Tests/paket.references b/tests/FsToolkit.ErrorHandling.TaskResult.Tests/paket.references
deleted file mode 100644
index 65004021..00000000
--- a/tests/FsToolkit.ErrorHandling.TaskResult.Tests/paket.references
+++ /dev/null
@@ -1,9 +0,0 @@
-
-group Test
- Expecto
- Expecto.Hopac
- Microsoft.NET.Test.Sdk
- YoloDev.Expecto.TestSdk
- Fable.Mocha
- Fable.Pyxpecto
- Microsoft.Bcl.AsyncInterfaces
diff --git a/tests/FsToolkit.ErrorHandling.TaskResult.Tests/BackgroundTaskOptionCE.fs b/tests/FsToolkit.ErrorHandling.Tests/BackgroundTaskOptionCE.fs
similarity index 98%
rename from tests/FsToolkit.ErrorHandling.TaskResult.Tests/BackgroundTaskOptionCE.fs
rename to tests/FsToolkit.ErrorHandling.Tests/BackgroundTaskOptionCE.fs
index dc5f2c4e..ef372092 100644
--- a/tests/FsToolkit.ErrorHandling.TaskResult.Tests/BackgroundTaskOptionCE.fs
+++ b/tests/FsToolkit.ErrorHandling.Tests/BackgroundTaskOptionCE.fs
@@ -9,7 +9,6 @@ let makeDisposable () =
member this.Dispose() = ()
}
-[]
let ceTests =
testList "Background TaskOption CE" [
testCaseTask "Return value"
@@ -431,7 +430,6 @@ let specialCaseTask returnValue =
Task.FromResult returnValue
#endif
-[]
let ceTestsApplicative =
testList "BackgroundTaskOptionCE applicative tests" [
testCaseTask "Happy Path Option/AsyncOption/Ply/ValueTask"
@@ -480,7 +478,6 @@ let ceTestsApplicative =
}
]
-[]
let ``BackgroundTaskOptionCE inference checks`` =
testList "BackgroundTaskOptionCE inference checks" [
testCase "Inference checks"
@@ -491,3 +488,10 @@ let ``BackgroundTaskOptionCE inference checks`` =
f (TaskOption.some ())
|> ignore
]
+
+let allTests =
+ testList "BackgroundTaskOptionCE CE Tests" [
+ ceTests
+ ceTestsApplicative
+ ``BackgroundTaskOptionCE inference checks``
+ ]
diff --git a/tests/FsToolkit.ErrorHandling.TaskResult.Tests/BackgroundTaskResultCE.fs b/tests/FsToolkit.ErrorHandling.Tests/BackgroundTaskResultCE.fs
similarity index 97%
rename from tests/FsToolkit.ErrorHandling.TaskResult.Tests/BackgroundTaskResultCE.fs
rename to tests/FsToolkit.ErrorHandling.Tests/BackgroundTaskResultCE.fs
index 977633e6..e4595587 100644
--- a/tests/FsToolkit.ErrorHandling.TaskResult.Tests/BackgroundTaskResultCE.fs
+++ b/tests/FsToolkit.ErrorHandling.Tests/BackgroundTaskResultCE.fs
@@ -1,14 +1,9 @@
module BackgroundTaskResultCETests
-
open Expecto
-open SampleDomain
-open TestData
open FsToolkit.ErrorHandling
open System.Threading.Tasks
-
-[]
let ``BackgroundTaskResultCE return Tests`` =
testList "BackgroundTaskResultCE Tests" [
testCaseTask "Return string"
@@ -20,8 +15,6 @@ let ``BackgroundTaskResultCE return Tests`` =
}
]
-
-[]
let ``BackgroundTaskResultCE return! Tests`` =
testList "BackgroundTaskResultCE return! Tests" [
testCaseTask "Return Ok Result"
@@ -111,8 +104,6 @@ let ``BackgroundTaskResultCE return! Tests`` =
#endif
]
-
-[]
let ``BackgroundTaskResultCE bind Tests`` =
testList "BackgroundTaskResultCE bind Tests" [
testCaseTask "Bind Ok Result"
@@ -264,8 +255,6 @@ let ``BackgroundTaskResultCE bind Tests`` =
#endif
]
-
-[]
let ``BackgroundTaskResultCE combine/zero/delay/run Tests`` =
testList "BackgroundTaskResultCE combine/zero/delay/run Tests" [
testCaseTask "Zero/Combine/Delay/Run"
@@ -287,8 +276,6 @@ let ``BackgroundTaskResultCE combine/zero/delay/run Tests`` =
}
]
-
-[]
let ``BackgroundTaskResultCE try Tests`` =
testList "BackgroundTaskResultCE try Tests" [
testCaseTask "Try With"
@@ -336,7 +323,6 @@ let makeDisposable () =
member this.Dispose() = ()
}
-[]
let ``BackgroundTaskResultCE using Tests`` =
testList "BackgroundTaskResultCE using Tests" [
testCaseTask "use normal disposable"
@@ -383,8 +369,6 @@ let ``BackgroundTaskResultCE using Tests`` =
}
]
-
-[]
let ``BackgroundTaskResultCE loop Tests`` =
testList "BackgroundTaskResultCE loop Tests" [
yield! [
@@ -517,8 +501,6 @@ let ``BackgroundTaskResultCE loop Tests`` =
}
]
-
-[]
let ``BackgroundTaskResultCE applicative tests`` =
testList "BackgroundTaskResultCE applicative tests" [
testCaseTask "Happy Path TaskResult"
@@ -702,8 +684,6 @@ let ``BackgroundTaskResultCE applicative tests`` =
}
]
-
-[]
let ``BackgroundTaskResultCE inference checks`` =
testList "BackgroundTaskResultCE inference checks" [
testCase "Inference checks"
@@ -714,3 +694,16 @@ let ``BackgroundTaskResultCE inference checks`` =
f (TaskResult.ok ())
|> ignore
]
+
+let allTests =
+ testList "BackgroundTaskResult CE Tests" [
+ ``BackgroundTaskResultCE return Tests``
+ ``BackgroundTaskResultCE return! Tests``
+ ``BackgroundTaskResultCE bind Tests``
+ ``BackgroundTaskResultCE combine/zero/delay/run Tests``
+ ``BackgroundTaskResultCE try Tests``
+ ``BackgroundTaskResultCE using Tests``
+ ``BackgroundTaskResultCE loop Tests``
+ ``BackgroundTaskResultCE applicative tests``
+ ``BackgroundTaskResultCE inference checks``
+ ]
diff --git a/tests/FsToolkit.ErrorHandling.TaskResult.Tests/Expecto.fs b/tests/FsToolkit.ErrorHandling.Tests/Expecto.fs
similarity index 90%
rename from tests/FsToolkit.ErrorHandling.TaskResult.Tests/Expecto.fs
rename to tests/FsToolkit.ErrorHandling.Tests/Expecto.fs
index 277280ae..2911acec 100644
--- a/tests/FsToolkit.ErrorHandling.TaskResult.Tests/Expecto.fs
+++ b/tests/FsToolkit.ErrorHandling.Tests/Expecto.fs
@@ -1,10 +1,10 @@
module Expecto
open Expecto
-open FsToolkit.ErrorHandling
open System
open System.Threading.Tasks
+#if !FABLE_COMPILER
let testCaseTask name test =
testCaseAsync
name
@@ -32,7 +32,6 @@ let ftestCaseTask name test =
|> Async.AwaitTask
})
-
module Expect =
open Expecto
@@ -51,13 +50,14 @@ module Expect =
match thrown with
| Choice1Of2 e when not (typeof<'texn>.IsAssignableFrom(e.GetType())) ->
- failtestf
+ Tests.failtestf
"%s. Expected f to throw an exn of type %s, but one of type %s was thrown."
message
(typeof<'texn>.FullName)
(e.GetType().FullName)
| Choice1Of2 _ -> ()
- | Choice2Of2 result -> failtestf "%s. Expected f to throw. returned %A" message result
+ | Choice2Of2 result ->
+ Tests.failtestf "%s. Expected f to throw. returned %A" message result
}
type Expect =
@@ -65,7 +65,8 @@ type Expect =
static member CancellationRequested(operation: Async<'a>) =
Expect.throwsTAsync<'a, OperationCanceledException> (operation) "Should have been cancelled"
-
static member CancellationRequested(operation: Task<_>) =
Expect.CancellationRequested(Async.AwaitTask operation)
|> Async.StartImmediateAsTask
+
+#endif
diff --git a/tests/FsToolkit.ErrorHandling.Tests/FsToolkit.ErrorHandling.Tests.fsproj b/tests/FsToolkit.ErrorHandling.Tests/FsToolkit.ErrorHandling.Tests.fsproj
index 7b3842b1..3393091b 100644
--- a/tests/FsToolkit.ErrorHandling.Tests/FsToolkit.ErrorHandling.Tests.fsproj
+++ b/tests/FsToolkit.ErrorHandling.Tests/FsToolkit.ErrorHandling.Tests.fsproj
@@ -9,10 +9,20 @@
+
+
-
+
+
+
+
+
+
+
+
+
diff --git a/tests/FsToolkit.ErrorHandling.Tests/List.fs b/tests/FsToolkit.ErrorHandling.Tests/List.fs
index 7ae8536b..f391daf0 100644
--- a/tests/FsToolkit.ErrorHandling.Tests/List.fs
+++ b/tests/FsToolkit.ErrorHandling.Tests/List.fs
@@ -612,6 +612,160 @@ let sequenceVOptionMTests =
Expect.equal actual ValueNone "traverse the list and return value none"
]
+let notifyNewPostSuccess x =
+ notifyNewPostSuccess x
+ >> Async.StartImmediateAsTask
+
+let notifyNewPostFailure x =
+ notifyNewPostFailure x
+ >> Async.StartImmediateAsTask
+
+let notifyFailureTask (PostId _) (UserId uId) =
+ task {
+ if
+ (uId = userId1
+ || uId = userId3)
+ then
+ return
+ $"error: %s{uId.ToString()}"
+ |> Error
+ else
+ return Ok()
+ }
+
+let traverseTaskResultMTests =
+
+ let userIds =
+ List.map UserId [
+ userId1
+ userId2
+ userId3
+ ]
+
+ testList "List.traverseTaskResultM Tests" [
+ testCase "traverseTaskResultM with a list of valid data"
+ <| fun _ ->
+ let expected =
+ userIds
+ |> List.map (fun (UserId user) -> (newPostId, user))
+
+ let actual =
+ List.traverseTaskResultM (notifyNewPostSuccess (PostId newPostId)) userIds
+
+ Expect.hasTaskOkValueSync expected actual
+
+ testCase "traverseResultA with few invalid data"
+ <| fun _ ->
+ let expected = $"error: %s{userId1.ToString()}"
+
+ let actual =
+ List.traverseTaskResultM (notifyNewPostFailure (PostId newPostId)) userIds
+
+ Expect.hasTaskErrorValueSync expected actual
+ ]
+
+let traverseTaskResultATests =
+ let userIds =
+ List.map UserId [
+ userId1
+ userId2
+ userId3
+ userId4
+ ]
+
+ testList "List.traverseTaskResultA Tests" [
+ testCase "traverseTaskResultA with a list of valid data"
+ <| fun _ ->
+ let expected =
+ userIds
+ |> List.map (fun (UserId user) -> (newPostId, user))
+
+ let actual =
+ List.traverseTaskResultA (notifyNewPostSuccess (PostId newPostId)) userIds
+
+ Expect.hasTaskOkValueSync expected actual
+
+ testCase "traverseResultA with few invalid data"
+ <| fun _ ->
+ let expected = [
+ $"error: %s{userId1.ToString()}"
+ $"error: %s{userId3.ToString()}"
+ ]
+
+ let actual = List.traverseTaskResultA (notifyFailureTask (PostId newPostId)) userIds
+
+ Expect.hasTaskErrorValueSync expected actual
+ ]
+
+let sequenceTaskResultMTests =
+ let userIds =
+ List.map UserId [
+ userId1
+ userId2
+ userId3
+ userId4
+ ]
+
+ testList "List.sequenceTaskResultM Tests" [
+ testCase "sequenceTaskResultM with a list of valid data"
+ <| fun _ ->
+ let expected =
+ userIds
+ |> List.map (fun (UserId user) -> (newPostId, user))
+
+ let actual =
+ List.map (notifyNewPostSuccess (PostId newPostId)) userIds
+ |> List.sequenceTaskResultM
+
+ Expect.hasTaskOkValueSync expected actual
+
+ testCase "sequenceTaskResultM with few invalid data"
+ <| fun _ ->
+ let expected = $"error: %s{userId1.ToString()}"
+
+ let actual =
+ List.map (notifyFailureTask (PostId newPostId)) userIds
+ |> List.sequenceTaskResultM
+
+ Expect.hasTaskErrorValueSync expected actual
+ ]
+
+let sequenceTaskResultATests =
+ let userIds =
+ List.map UserId [
+ userId1
+ userId2
+ userId3
+ userId4
+ ]
+
+ testList "List.sequenceTaskResultA Tests" [
+ testCase "sequenceTaskResultA with a list of valid data"
+ <| fun _ ->
+ let expected =
+ userIds
+ |> List.map (fun (UserId user) -> (newPostId, user))
+
+ let actual =
+ List.map (notifyNewPostSuccess (PostId newPostId)) userIds
+ |> List.sequenceTaskResultA
+
+ Expect.hasTaskOkValueSync expected actual
+
+ testCase "sequenceTaskResultA with few invalid data"
+ <| fun _ ->
+ let expected = [
+ $"error: %s{userId1.ToString()}"
+ $"error: %s{userId3.ToString()}"
+ ]
+
+ let actual =
+ List.map (notifyFailureTask (PostId newPostId)) userIds
+ |> List.sequenceTaskResultA
+
+ Expect.hasTaskErrorValueSync expected actual
+ ]
+
#endif
let allTests =
@@ -633,5 +787,9 @@ let allTests =
#if !FABLE_COMPILER
traverseVOptionMTests
sequenceVOptionMTests
+ traverseTaskResultMTests
+ traverseTaskResultATests
+ sequenceTaskResultMTests
+ sequenceTaskResultATests
#endif
]
diff --git a/tests/FsToolkit.ErrorHandling.Tests/Main.fs b/tests/FsToolkit.ErrorHandling.Tests/Main.fs
index 118c6472..f6155bf1 100644
--- a/tests/FsToolkit.ErrorHandling.Tests/Main.fs
+++ b/tests/FsToolkit.ErrorHandling.Tests/Main.fs
@@ -34,6 +34,17 @@ let allTests =
ValidationCETests.allTests
ValueOptionTests.allTests
ValueOptionCETests.allTests
+ #if !FABLE_COMPILER
+ BackgroundTaskOptionCETests.allTests
+ BackgroundTaskResultCETests.allTests
+ TaskOptionTests.allTests
+ TaskOptionCETests.allTests
+ TaskResultTests.allTests
+ TaskResultCETests.allTests
+ TaskResultOptionTests.allTests
+ TaskValidationTests.allTests
+ TaskValidationCETests.allTests
+ #endif
]
[]
diff --git a/tests/FsToolkit.ErrorHandling.Tests/Result.fs b/tests/FsToolkit.ErrorHandling.Tests/Result.fs
index acec025c..3b442672 100644
--- a/tests/FsToolkit.ErrorHandling.Tests/Result.fs
+++ b/tests/FsToolkit.ErrorHandling.Tests/Result.fs
@@ -793,6 +793,37 @@ let traverseAsyncTests =
}
]
+#if !FABLE_COMPILER
+
+let sequenceTaskTests =
+ testList "sequenceTask Tests" [
+ testCase "sequenceTask returns the task value if Ok"
+ <| fun _ ->
+ let resTask =
+ task { return "foo" }
+ |> Ok
+
+ let value =
+ (resTask
+ |> Result.sequenceTask)
+ .Result
+
+ Expect.equal value (Ok "foo") ""
+
+ testCase "sequenceTask returns the error value if Error"
+ <| fun _ ->
+ let resTask = Error "foo"
+
+ let value =
+ (resTask
+ |> Result.sequenceTask)
+ .Result
+
+ Expect.equal value (Error "foo") ""
+ ]
+
+#endif
+
let valueOrTests =
testList "valueOrTests Tests" [
testCase "valueOrTests returns the value if Ok"
@@ -936,6 +967,9 @@ let allTests =
teeErrorIfTests
sequenceAsyncTests
traverseAsyncTests
+#if !FABLE_COMPILER
+ sequenceTaskTests
+#endif
valueOrTests
zipTests
zipErrorTests
diff --git a/tests/FsToolkit.ErrorHandling.TaskResult.Tests/TaskOption.fs b/tests/FsToolkit.ErrorHandling.Tests/TaskOption.fs
similarity index 97%
rename from tests/FsToolkit.ErrorHandling.TaskResult.Tests/TaskOption.fs
rename to tests/FsToolkit.ErrorHandling.Tests/TaskOption.fs
index 89666d41..00343871 100644
--- a/tests/FsToolkit.ErrorHandling.TaskResult.Tests/TaskOption.fs
+++ b/tests/FsToolkit.ErrorHandling.Tests/TaskOption.fs
@@ -1,15 +1,6 @@
module TaskOptionTests
-
-#if FABLE_COMPILER_PYTHON
-open Fable.Pyxpecto
-#endif
-#if FABLE_COMPILER_JAVASCRIPT
-open Fable.Mocha
-#endif
-#if !FABLE_COMPILER
open Expecto
-#endif
open System
open System.Threading.Tasks
diff --git a/tests/FsToolkit.ErrorHandling.TaskResult.Tests/TaskOptionCE.fs b/tests/FsToolkit.ErrorHandling.Tests/TaskOptionCE.fs
similarity index 99%
rename from tests/FsToolkit.ErrorHandling.TaskResult.Tests/TaskOptionCE.fs
rename to tests/FsToolkit.ErrorHandling.Tests/TaskOptionCE.fs
index 2d8cc33c..f7d23b52 100644
--- a/tests/FsToolkit.ErrorHandling.TaskResult.Tests/TaskOptionCE.fs
+++ b/tests/FsToolkit.ErrorHandling.Tests/TaskOptionCE.fs
@@ -12,8 +12,6 @@ module TestFuncs =
System.Console.WriteLine(dto)
}
-
-[]
let ceTests =
testList "TaskOption CE" [
testCaseTask "Return value"
@@ -563,7 +561,6 @@ let specialCaseTask returnValue =
Task.FromResult returnValue
#endif
-[]
let ceTestsApplicative =
testList "TaskOptionCE applicative tests" [
testCaseTask "Happy Path Option/AsyncOption/Ply/ValueTask"
@@ -612,8 +609,6 @@ let ceTestsApplicative =
}
]
-
-[]
let ``TaskOptionCE inference checks`` =
testList "TaskOptionCE inference checks" [
testCase "Inference checks"
@@ -624,3 +619,10 @@ let ``TaskOptionCE inference checks`` =
f (TaskOption.some ())
|> ignore
]
+
+let allTests =
+ testList "TaskOption CE Tests" [
+ ceTests
+ ceTestsApplicative
+ ``TaskOptionCE inference checks``
+ ]
diff --git a/tests/FsToolkit.ErrorHandling.TaskResult.Tests/TaskResult.fs b/tests/FsToolkit.ErrorHandling.Tests/TaskResult.fs
similarity index 96%
rename from tests/FsToolkit.ErrorHandling.TaskResult.Tests/TaskResult.fs
rename to tests/FsToolkit.ErrorHandling.Tests/TaskResult.fs
index d52afcc3..f0a627f0 100644
--- a/tests/FsToolkit.ErrorHandling.TaskResult.Tests/TaskResult.fs
+++ b/tests/FsToolkit.ErrorHandling.Tests/TaskResult.fs
@@ -32,7 +32,6 @@ let allowedToPost =
allowedToPost
>> Async.StartImmediateAsTask
-[]
let mapTests =
testList "TaskResult.map tests" [
testCase "map with Task(Ok x)"
@@ -48,7 +47,6 @@ let mapTests =
|> Expect.hasTaskErrorValueSync { Message = "something went wrong!" }
]
-[]
let map2Tests =
testList "TaskResult.map2 tests" [
testCase "map2 with Task(Ok x) Task(Ok y)"
@@ -91,7 +89,6 @@ let map2Tests =
|> Expect.hasTaskErrorValueSync getFollowersEx
]
-[]
let mapErrorTests =
testList "TaskResult.mapError tests" [
testCase "mapError with Task(Ok x)"
@@ -108,7 +105,6 @@ let mapErrorTests =
|> Expect.hasTaskErrorValueSync (commonEx.Message)
]
-[]
let bindTests =
testList "TaskResult.bind tests" [
testCase "bind with Task(Ok x)"
@@ -139,8 +135,6 @@ let bindTests =
|> Expect.hasTaskErrorValueSync ex
]
-
-[]
let orElseTests =
testList "TaskResult.orElseWith Tests" [
testCaseTask "Ok Ok takes first Ok"
@@ -177,7 +171,6 @@ let orElseTests =
}
]
-[]
let orElseWithTests =
testList "TaskResult.orElse Tests" [
testCaseTask "Ok Ok takes first Ok"
@@ -214,7 +207,6 @@ let orElseWithTests =
}
]
-[]
let ignoreTests =
testList "TaskResult.ignore tests" [
testCase "ignore with Task(Ok x)"
@@ -241,7 +233,6 @@ let ignoreTests =
let err = "foobar"
let toTask x = task { return x }
-[]
let requireTrueTests =
testList "TaskResult.requireTrue Tests" [
testCase "requireTrue happy path"
@@ -257,7 +248,6 @@ let requireTrueTests =
|> Expect.hasTaskErrorValueSync err
]
-[]
let requireFalseTests =
testList "TaskResult.requireFalse Tests" [
testCase "requireFalse happy path"
@@ -273,7 +263,6 @@ let requireFalseTests =
|> Expect.hasTaskErrorValueSync err
]
-[]
let requireSomeTests =
testList "TaskResult.requireSome Tests" [
testCase "requireSome happy path"
@@ -289,7 +278,6 @@ let requireSomeTests =
|> Expect.hasTaskErrorValueSync err
]
-[]
let requireNoneTests =
testList "TaskResult.requireNone Tests" [
testCase "requireNone happy path"
@@ -305,7 +293,6 @@ let requireNoneTests =
|> Expect.hasTaskErrorValueSync err
]
-[]
let requireValueSomeTests =
testList "TaskResult.requireValueSome Tests" [
testCase "requireValueSome happy path"
@@ -321,7 +308,6 @@ let requireValueSomeTests =
|> Expect.hasTaskErrorValueSync err
]
-[]
let requireValueNoneTests =
testList "TaskResult.requireValueNone Tests" [
testCase "requireValueNone happy path"
@@ -337,7 +323,6 @@ let requireValueNoneTests =
|> Expect.hasTaskErrorValueSync err
]
-[]
let requireEqualToTests =
testList "TaskResult.requireEqualTo Tests" [
testCase "requireEqualTo happy path"
@@ -353,7 +338,6 @@ let requireEqualToTests =
|> Expect.hasTaskErrorValueSync err
]
-[]
let requireEqualTests =
testList "TaskResult.requireEqual Tests" [
testCase "requireEqual happy path"
@@ -367,7 +351,6 @@ let requireEqualTests =
|> Expect.hasTaskErrorValueSync err
]
-[]
let requireEmptyTests =
testList "TaskResult.requireEmpty Tests" [
testCase "requireEmpty happy path"
@@ -383,7 +366,6 @@ let requireEmptyTests =
|> Expect.hasTaskErrorValueSync err
]
-[]
let requireNotEmptyTests =
testList "TaskResult.requireNotEmpty Tests" [
testCase "requireNotEmpty happy path"
@@ -399,7 +381,6 @@ let requireNotEmptyTests =
|> Expect.hasTaskErrorValueSync err
]
-[]
let requireHeadTests =
testList "TaskResult.requireHead Tests" [
testCase "requireHead happy path"
@@ -415,7 +396,6 @@ let requireHeadTests =
|> Expect.hasTaskErrorValueSync err
]
-[]
let taskResultRequireTests =
testList "TaskResult.require Tests" [
testCaseTask "True, Ok"
@@ -451,7 +431,6 @@ let taskResultRequireTests =
}
]
-[]
let setErrorTests =
testList "TaskResult.setError Tests" [
testCase "setError replaces a any error value with a custom error value"
@@ -467,7 +446,6 @@ let setErrorTests =
|> Expect.hasTaskOkValueSync 42
]
-[]
let withErrorTests =
testList "TaskResult.withError Tests" [
testCase "withError replaces a any error value with a custom error value"
@@ -483,7 +461,6 @@ let withErrorTests =
|> Expect.hasTaskOkValueSync 42
]
-[]
let defaultValueTests =
testList "TaskResult.defaultValue Tests" [
testCase "defaultValue returns the ok value"
@@ -499,7 +476,6 @@ let defaultValueTests =
Expect.hasTaskValue 43 v
]
-[]
let defaultErrorTests =
testList "TaskResult.defaultError Tests" [
testCase "defaultError returns the error value"
@@ -515,7 +491,6 @@ let defaultErrorTests =
Expect.hasTaskValue 43 v
]
-[]
let defaultWithTests =
testList "TaskResult.defaultWith Tests" [
testCase "defaultWith returns the ok value"
@@ -531,7 +506,6 @@ let defaultWithTests =
Expect.hasTaskValue 42 v
]
-[]
let ignoreErrorTests =
testList "TaskResult.ignoreError Tests" [
testCase "ignoreError returns the unit for ok"
@@ -547,7 +521,6 @@ let ignoreErrorTests =
<| fun _ -> ignore> -> Task> TaskResult.ignoreError
]
-[]
let teeTests =
testList "TaskResult.tee Tests" [
@@ -580,7 +553,6 @@ let teeTests =
let returnTrue _ = true
let returnFalse _ = false
-[]
let teeIfTests =
testList "TaskResult.teeIf Tests" [
testCase "teeIf executes the function for ok and true predicate "
@@ -629,7 +601,6 @@ let teeIfTests =
Expect.equal foo "foo" ""
]
-[]
let teeErrorTests =
testList "TaskResult.teeError Tests" [
@@ -660,8 +631,6 @@ let teeErrorTests =
Expect.equal foo "foo" ""
]
-
-[]
let teeErrorIfTests =
testList "TaskResult.teeErrorIf Tests" [
testCase "teeErrorIf executes the function for Error and true predicate "
@@ -710,7 +679,6 @@ let teeErrorIfTests =
Expect.equal foo "foo" ""
]
-[]
let catchTests =
let f (e: exn) = e.Message
@@ -732,7 +700,6 @@ let catchTests =
Expect.hasTaskErrorValueSync "unmapped" (TaskResult.catch f (toTask (Error "unmapped")))
]
-[]
let zipTests =
testList "TaskResult.zip tests" [
testCase "Ok, Ok"
@@ -760,7 +727,6 @@ let zipTests =
Expect.hasTaskValue (Error("Bad1")) v
]
-[]
let zipErrorTests =
testList "TaskResult.zipError tests" [
testCase "Ok, Ok"
@@ -792,7 +758,6 @@ type CreatePostResult =
| PostSuccess of NotifyNewPostRequest
| NotAllowedToPost
-[]
let TaskResultCETests =
let createPost userId =
taskResult {
@@ -828,7 +793,6 @@ let TaskResultCETests =
|> Expect.hasTaskErrorValueSync commonEx
]
-[]
let TaskResultOperatorTests =
testList "TaskResult Operators Tests" [
testCase "map & apply operators"
@@ -856,7 +820,6 @@ let TaskResultOperatorTests =
|> Expect.hasTaskOkValueSync (PostId newPostId)
]
-[]
let TaskResultBindRequireTests =
testList "TaskResult Bind + Require Tests" [
testCaseTask "bindRequireNone"
@@ -880,7 +843,6 @@ let TaskResultBindRequireTests =
}
]
-[]
let TaskResultBindRequireValueOptionTests =
testList "TaskResult Bind + RequireValueOption Tests" [
testCaseTask "bindRequireValueNone"
@@ -904,7 +866,6 @@ let TaskResultBindRequireValueOptionTests =
}
]
-[]
let foldResultTests =
testList "TaskResult.foldResult tests" [
testCaseTask "foldResult with Task(Ok x)"
@@ -929,7 +890,6 @@ let foldResultTests =
}
]
-[]
let taskResultBindRequireTrueTests =
testList "TaskResult Bind + RequireTrue Tests" [
testCaseTask "bindRequireTrue"
@@ -953,7 +913,6 @@ let taskResultBindRequireTrueTests =
}
]
-[]
let taskResultBindRequireNotNullTests =
testList "TaskResult Bind + RequireNotNull Tests" [
testCaseTask "bindRequireNotNull"
@@ -967,7 +926,6 @@ let taskResultBindRequireNotNullTests =
}
]
-[]
let taskResultBindRequireEqualTests =
testList "TaskResult Bind + RequireEqual Tests" [
testCaseTask "bindRequireEqual"
@@ -981,7 +939,6 @@ let taskResultBindRequireEqualTests =
}
]
-[]
let taskResultBindRequireEmptyTests =
testList "TaskResult Bind + RequireEmpty Tests" [
testCaseTask "bindRequireEmpty"
@@ -995,7 +952,6 @@ let taskResultBindRequireEmptyTests =
}
]
-[]
let taskResultBindRequireNotEmptyTests =
testList "TaskResult Bind + RequireNotEmpty Tests" [
testCaseTask "bindRequireNotEmpty"
@@ -1009,7 +965,6 @@ let taskResultBindRequireNotEmptyTests =
}
]
-[]
let taskResultBindRequireHeadTests =
testList "TaskResult Bind + RequireHead Tests" [
testCaseTask "bindRequireHead"
@@ -1023,8 +978,6 @@ let taskResultBindRequireHeadTests =
}
]
-
-[]
let taskResultCheckTests =
testList "TaskResult.check Tests" [
testCaseTask "Ok, Ok"
@@ -1059,3 +1012,51 @@ let taskResultCheckTests =
|> Expect.hasTaskErrorValue (2)
}
]
+
+let allTests =
+ testList "TaskResult Tests" [
+ mapTests
+ map2Tests
+ mapErrorTests
+ bindTests
+ orElseTests
+ orElseWithTests
+ ignoreTests
+ requireTrueTests
+ requireFalseTests
+ requireSomeTests
+ requireNoneTests
+ requireValueSomeTests
+ requireValueNoneTests
+ requireEqualToTests
+ requireEqualTests
+ requireEmptyTests
+ requireNotEmptyTests
+ requireHeadTests
+ taskResultRequireTests
+ setErrorTests
+ withErrorTests
+ defaultValueTests
+ defaultErrorTests
+ defaultWithTests
+ ignoreErrorTests
+ teeTests
+ teeIfTests
+ teeErrorTests
+ teeErrorIfTests
+ catchTests
+ zipTests
+ zipErrorTests
+ TaskResultCETests
+ TaskResultOperatorTests
+ TaskResultBindRequireTests
+ TaskResultBindRequireValueOptionTests
+ foldResultTests
+ taskResultBindRequireTrueTests
+ taskResultBindRequireNotNullTests
+ taskResultBindRequireEqualTests
+ taskResultBindRequireEmptyTests
+ taskResultBindRequireNotEmptyTests
+ taskResultBindRequireHeadTests
+ taskResultCheckTests
+ ]
diff --git a/tests/FsToolkit.ErrorHandling.TaskResult.Tests/TaskResultCE.fs b/tests/FsToolkit.ErrorHandling.Tests/TaskResultCE.fs
similarity index 98%
rename from tests/FsToolkit.ErrorHandling.TaskResult.Tests/TaskResultCE.fs
rename to tests/FsToolkit.ErrorHandling.Tests/TaskResultCE.fs
index a0ef0180..311bca5d 100644
--- a/tests/FsToolkit.ErrorHandling.TaskResult.Tests/TaskResultCE.fs
+++ b/tests/FsToolkit.ErrorHandling.Tests/TaskResultCE.fs
@@ -1,14 +1,9 @@
module TaskResultCETests
-
open Expecto
-open SampleDomain
-open TestData
open FsToolkit.ErrorHandling
open System.Threading.Tasks
-
-[]
let ``TaskResultCE return Tests`` =
testList "TaskResultCE Tests" [
testCaseTask "Return string"
@@ -20,8 +15,6 @@ let ``TaskResultCE return Tests`` =
}
]
-
-[]
let ``TaskResultCE return! Tests`` =
testList "TaskResultCE return! Tests" [
testCaseTask "Return Ok Result"
@@ -101,8 +94,6 @@ let ``TaskResultCE return! Tests`` =
}
]
-
-[]
let ``TaskResultCE bind Tests`` =
testList "TaskResultCE bind Tests" [
testCaseTask "Bind Ok Result"
@@ -239,8 +230,6 @@ let ``TaskResultCE bind Tests`` =
}
]
-
-[]
let ``TaskResultCE combine/zero/delay/run Tests`` =
testList "TaskResultCE combine/zero/delay/run Tests" [
testCaseTask "Zero/Combine/Delay/Run"
@@ -279,8 +268,6 @@ let ``TaskResultCE combine/zero/delay/run Tests`` =
]
-
-[]
let ``TaskResultCE try Tests`` =
testList "TaskResultCE try Tests" [
testCaseTask "Try With"
@@ -323,8 +310,6 @@ let ``TaskResultCE try Tests`` =
}
]
-
-[]
let ``TaskResultCE using Tests`` =
testList "TaskResultCE using Tests" [
testCaseTask "use normal disposable"
@@ -424,8 +409,6 @@ let ``TaskResultCE using Tests`` =
}
]
-
-[]
let ``TaskResultCE loop Tests`` =
testList "TaskResultCE loop Tests" [
yield! [
@@ -559,8 +542,6 @@ let ``TaskResultCE loop Tests`` =
}
]
-
-[]
let ``TaskResultCE applicative tests`` =
testList "TaskResultCE applicative tests" [
testCaseTask "Happy Path TaskResult"
@@ -739,8 +720,6 @@ let ``TaskResultCE applicative tests`` =
}
]
-
-[]
let ``TaskResultCE inference checks`` =
testList "TaskResultCE inference checks" [
testCase "Inference checks"
@@ -751,3 +730,16 @@ let ``TaskResultCE inference checks`` =
f (TaskResult.ok)
|> ignore
]
+
+let allTests =
+ testList "TaskResult CE Tests" [
+ ``TaskResultCE return Tests``
+ ``TaskResultCE return! Tests``
+ ``TaskResultCE bind Tests``
+ ``TaskResultCE combine/zero/delay/run Tests``
+ ``TaskResultCE try Tests``
+ ``TaskResultCE using Tests``
+ ``TaskResultCE loop Tests``
+ ``TaskResultCE applicative tests``
+ ``TaskResultCE inference checks``
+ ]
diff --git a/tests/FsToolkit.ErrorHandling.TaskResult.Tests/TaskResultOption.fs b/tests/FsToolkit.ErrorHandling.Tests/TaskResultOption.fs
similarity index 97%
rename from tests/FsToolkit.ErrorHandling.TaskResult.Tests/TaskResultOption.fs
rename to tests/FsToolkit.ErrorHandling.Tests/TaskResultOption.fs
index 7dcefff2..1f61ee15 100644
--- a/tests/FsToolkit.ErrorHandling.TaskResult.Tests/TaskResultOption.fs
+++ b/tests/FsToolkit.ErrorHandling.Tests/TaskResultOption.fs
@@ -16,8 +16,6 @@ let getPostById x =
getPostById x
|> Async.StartImmediateAsTask
-
-[]
let mapTests =
testList "TaskResultOption.map tests" [
testCase "map with Task(Ok Some(x))"
@@ -47,8 +45,6 @@ let userTweet (p: Post) (u: User) = {
Tweet = p.Tweet.Value
}
-
-[]
let bindTests =
testList "TaskResultOption.bind tests" [
testCase "bind with Task(Ok Some(x)) Task(Ok Some(x))"
@@ -91,7 +87,6 @@ let bindTests =
|> Expect.hasTaskErrorValueSync "invalid post id"
]
-[]
let map2Tests =
testList "TaskResultOption.map2 tests" [
testCase "map2 with Task(Ok Some(x)) Task(Ok Some(x))"
@@ -148,7 +143,6 @@ let map2Tests =
|> Expect.hasTaskErrorValueSync "invalid post id"
]
-[]
let ignoreTests =
testList "TaskResultOption.ignore tests" [
testCase "ignore with Task(Ok Some(x))"
@@ -178,7 +172,6 @@ let ignoreTests =
TaskResultOption.ignore
]
-[]
let computationExpressionTests =
testList "taskResultOption CE tests" [
testCase "CE with Task(Ok Some(x)) Task(Ok Some(x))"
@@ -223,7 +216,6 @@ let computationExpressionTests =
|> Expect.hasTaskErrorValueSync "invalid post id"
]
-[]
let operatorTests =
testList "TaskResultOption Operators Tests" [
testCase "map & apply operators"
@@ -256,8 +248,6 @@ let operatorTests =
)
]
-
-[]
let ``TaskResultOptionCE inference checks`` =
testList "TaskResultOption inference checks" [
testCase "Inference checks"
@@ -268,3 +258,14 @@ let ``TaskResultOptionCE inference checks`` =
f (TaskResultOption.singleton ())
|> ignore
]
+
+let allTests =
+ testList "TaskResultOption Tests" [
+ mapTests
+ bindTests
+ map2Tests
+ ignoreTests
+ computationExpressionTests
+ operatorTests
+ ``TaskResultOptionCE inference checks``
+ ]
diff --git a/tests/FsToolkit.ErrorHandling.TaskResult.Tests/TaskValidation.fs b/tests/FsToolkit.ErrorHandling.Tests/TaskValidation.fs
similarity index 98%
rename from tests/FsToolkit.ErrorHandling.TaskResult.Tests/TaskValidation.fs
rename to tests/FsToolkit.ErrorHandling.Tests/TaskValidation.fs
index 36afc459..e3847f01 100644
--- a/tests/FsToolkit.ErrorHandling.TaskResult.Tests/TaskValidation.fs
+++ b/tests/FsToolkit.ErrorHandling.Tests/TaskValidation.fs
@@ -1,14 +1,6 @@
module TaskValidationTests
-#if FABLE_COMPILER_PYTHON
-open Fable.Pyxpecto
-#endif
-#if FABLE_COMPILER_JAVASCRIPT
-open Fable.Mocha
-#endif
-#if !FABLE_COMPILER
open Expecto
-#endif
open SampleDomain
open TestData
@@ -18,7 +10,6 @@ open FsToolkit.ErrorHandling.Operator.TaskValidation
let lift = TaskValidation.ofResult
-[]
let map2Tests =
testList "TaskValidation.map2 Tests" [
testCaseTask "map2 with two ok parts"
@@ -65,7 +56,6 @@ let map2Tests =
}
]
-[]
let map3Tests =
testList "TaskValidation.map3 Tests" [
testCaseTask "map3 with three ok parts"
@@ -149,7 +139,6 @@ let map3Tests =
}
]
-[]
let applyTests =
testList "TaskValidation.apply tests" [
@@ -184,7 +173,6 @@ let applyTests =
}
]
-[]
let operatorsTests =
testList "TaskValidation Operators Tests" [
@@ -221,7 +209,6 @@ let operatorsTests =
}
]
-[]
let zipTests =
testList "zip tests" [
testCaseTask "Ok, Ok"
@@ -274,7 +261,6 @@ let zipTests =
}
]
-[]
let orElseTests =
testList "TaskValidation.orElseWith Tests" [
testCaseTask "Ok Ok takes first Ok"
@@ -342,7 +328,6 @@ let orElseTests =
}
]
-[]
let orElseWithTests =
testList "TaskValidation.orElse Tests" [
testCaseTask "Ok Ok takes first Ok"
@@ -409,3 +394,14 @@ let orElseWithTests =
|> Expect.hasErrorValue [ "Second" ]
}
]
+
+let allTests =
+ testList "TaskValidation Tests" [
+ map2Tests
+ map3Tests
+ applyTests
+ operatorsTests
+ zipTests
+ orElseTests
+ orElseWithTests
+ ]
diff --git a/tests/FsToolkit.ErrorHandling.TaskResult.Tests/TaskValidationCE.fs b/tests/FsToolkit.ErrorHandling.Tests/TaskValidationCE.fs
similarity index 98%
rename from tests/FsToolkit.ErrorHandling.TaskResult.Tests/TaskValidationCE.fs
rename to tests/FsToolkit.ErrorHandling.Tests/TaskValidationCE.fs
index 3d567ead..9c73a239 100644
--- a/tests/FsToolkit.ErrorHandling.TaskResult.Tests/TaskValidationCE.fs
+++ b/tests/FsToolkit.ErrorHandling.Tests/TaskValidationCE.fs
@@ -4,7 +4,6 @@ open Expecto
open FsToolkit.ErrorHandling
open System.Threading.Tasks
-[]
let ``TaskValidationCE return Tests`` =
testList "TaskValidationCE Tests" [
testCaseTask "Return string"
@@ -16,7 +15,6 @@ let ``TaskValidationCE return Tests`` =
}
]
-[]
let ``TaskValidationCE return! Tests`` =
testList "TaskValidationCE return! Tests" [
testCaseTask "Return Ok Validation"
@@ -96,7 +94,6 @@ let ``TaskValidationCE return! Tests`` =
}
]
-[]
let ``TaskValidationCE bind Tests`` =
testList "TaskValidationCE bind Tests" [
testCaseTask "Bind Ok Validation"
@@ -233,7 +230,6 @@ let ``TaskValidationCE bind Tests`` =
}
]
-[]
let ``TaskValidationCE combine/zero/delay/run Tests`` =
testList "TaskValidationCE combine/zero/delay/run Tests" [
testCaseTask "Zero/Combine/Delay/Run"
@@ -271,7 +267,6 @@ let ``TaskValidationCE combine/zero/delay/run Tests`` =
}
]
-[]
let ``TaskValidationCE try Tests`` =
testList "TaskValidationCE try Tests" [
testCaseTask "Try With"
@@ -314,7 +309,6 @@ let ``TaskValidationCE try Tests`` =
}
]
-[]
let ``TaskValidationCE using Tests`` =
testList "TaskValidationCE using Tests" [
testCaseTask "use normal disposable"
@@ -414,7 +408,6 @@ let ``TaskValidationCE using Tests`` =
}
]
-[]
let ``TaskValidationCE loop Tests`` =
testList "TaskValidationCE loop Tests" [
yield! [
@@ -548,7 +541,6 @@ let ``TaskValidationCE loop Tests`` =
}
]
-[]
let ``TaskValidationCE applicative tests`` =
testList "TaskValidationCE applicative tests" [
testCaseTask "Happy Path TaskValidation"
@@ -752,7 +744,6 @@ let ``TaskValidationCE applicative tests`` =
}
]
-[]
let ``TaskValidationCE inference checks`` =
testList "TaskValidationCE inference checks" [
testCase "Inference checks"
@@ -763,3 +754,16 @@ let ``TaskValidationCE inference checks`` =
f (TaskValidation.ok)
|> ignore
]
+
+let allTests =
+ testList "TaskValidation CE Tests" [
+ ``TaskValidationCE return Tests``
+ ``TaskValidationCE return! Tests``
+ ``TaskValidationCE bind Tests``
+ ``TaskValidationCE combine/zero/delay/run Tests``
+ ``TaskValidationCE try Tests``
+ ``TaskValidationCE using Tests``
+ ``TaskValidationCE loop Tests``
+ ``TaskValidationCE applicative tests``
+ ``TaskValidationCE inference checks``
+ ]