Skip to content

Commit

Permalink
testSequencedGroup MergeSources
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAngryByrd committed Feb 7, 2024
1 parent 07c12d4 commit 133b88a
Show file tree
Hide file tree
Showing 13 changed files with 38 additions and 17 deletions.
10 changes: 10 additions & 0 deletions src/IcedTasks/TaskLike.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ namespace IcedTasks

open System.Runtime.CompilerServices
open Microsoft.FSharp.Core.CompilerServices
open System.Threading

/// <namespacedoc>
/// <summary>
Expand All @@ -18,6 +19,15 @@ type Awaiter<'Awaiter, 'TResult
and 'Awaiter: (member get_IsCompleted: unit -> bool)
and 'Awaiter: (member GetResult: unit -> 'TResult)> = 'Awaiter

/// A structure that looks like an Awaiter that returns a Result type
type AwaiterOfResult<'Awaiter, 'TResult, 'Error
when 'Awaiter :> ICriticalNotifyCompletion
and 'Awaiter: (member get_IsCompleted: unit -> bool)
and 'Awaiter: (member GetResult: unit -> Result<'TResult, 'Error>)> = 'Awaiter

type CancellableAwaiter<'Awaiter, 'TResult when Awaiter<'Awaiter, 'TResult>> =
CancellationToken -> Awaiter<'Awaiter, 'TResult>

/// Functions for Awaiters
type Awaiter =
/// Gets a value that indicates whether the asynchronous task has completed
Expand Down
3 changes: 2 additions & 1 deletion tests/IcedTasks.Tests/CancellablePoolingValueTaskTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,8 @@ module CancellablePoolingValueTaskTests =
]


testList "MergeSources" [
testSequencedGroup "MergeSources"
<| testList "MergeSources" [

testCaseAsync "and! cancellableTask x cancellableTask"
<| async {
Expand Down
4 changes: 2 additions & 2 deletions tests/IcedTasks.Tests/CancellableTaskTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,8 @@ module CancellableTaskTests =
}
]

testList "MergeSources" [
testSequencedGroup "MergeSources"
<| testList "MergeSources" [

testCaseAsync "and! cancellableTask x cancellableTask"
<| async {
Expand Down Expand Up @@ -888,7 +889,6 @@ module CancellableTaskTests =
Expect.equal actual 2 ""
}


testCaseAsync "and! awaitableUnit x awaitableT "
<| async {
let! actual =
Expand Down
4 changes: 2 additions & 2 deletions tests/IcedTasks.Tests/CancellableValueTaskTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -852,8 +852,8 @@ module CancellableValueTaskTests =
}

]

testList "MergeSources" [
testSequencedGroup "MergeSources"
<| testList "MergeSources" [

testCaseAsync "and! cancellableTask x cancellableTask"
<| async {
Expand Down
3 changes: 2 additions & 1 deletion tests/IcedTasks.Tests/ColdTaskTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,8 @@ module ColdTaskTests =
)
]

testList "MergeSources" [
testSequencedGroup "MergeSources"
<| testList "MergeSources" [
testCaseAsync "and! 5"
<| async {
let! actual =
Expand Down
3 changes: 2 additions & 1 deletion tests/IcedTasks.Tests/ParallelAsyncTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@ module ParallelAsyncTests =
}
]

testList "MergeSources" [
testSequencedGroup "MergeSources"
<| testList "MergeSources" [
testCaseAsync "and!"
<| async {
let data = 42
Expand Down
3 changes: 2 additions & 1 deletion tests/IcedTasks.Tests/PoolingValueTaskDynamicTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,8 @@ module PoolingValueTaskDynamicTests =
)
]

testList "MergeSources" [
testSequencedGroup "MergeSources"
<| testList "MergeSources" [

testCaseAsync "and! task x task"
<| asyncEx {
Expand Down
3 changes: 2 additions & 1 deletion tests/IcedTasks.Tests/PoolingValueTaskTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,8 @@ module PoolingValueTaskTests =
)
]

testList "MergeSources" [
testSequencedGroup "MergeSources"
<| testList "MergeSources" [

testCaseAsync "and! task x task"
<| asyncEx {
Expand Down
4 changes: 3 additions & 1 deletion tests/IcedTasks.Tests/TaskBackgroundTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,9 @@ module TaskBackgroundTests =
)

]
testList "MergeSources" [

testSequencedGroup "MergeSources"
<| testList "MergeSources" [

testCaseAsync "and! task x task"
<| asyncEx {
Expand Down
8 changes: 4 additions & 4 deletions tests/IcedTasks.Tests/TaskDynamicTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -628,14 +628,14 @@ module TaskDynamicTests =

]

testList "MergeSources" [

testSequencedGroup "MergeSources"
<| testList "MergeSources" [
testCaseAsync "and! task x task"
<| asyncEx {
let! actual =
dTask {
let! a = dTask { return 1 }
and! b = dTask { return 2 }
let! a = task { return 1 }
and! b = task { return 2 }
return a + b
}

Expand Down
3 changes: 2 additions & 1 deletion tests/IcedTasks.Tests/TaskTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,8 @@ module TaskTests =

]

testList "MergeSources" [
testSequencedGroup "MergeSources"
<| testList "MergeSources" [

testCaseAsync "and! task x task"
<| asyncEx {
Expand Down
4 changes: 3 additions & 1 deletion tests/IcedTasks.Tests/ValueTaskDynamicTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,9 @@ module ValueTaskDynamicTests =
)

]
testList "MergeSources" [

testSequencedGroup "MergeSources"
<| testList "MergeSources" [

testCaseAsync "and! task x task"
<| asyncEx {
Expand Down
3 changes: 2 additions & 1 deletion tests/IcedTasks.Tests/ValueTaskTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,8 @@ module ValueTaskTests =

]

testList "MergeSources" [
testSequencedGroup "MergeSources"
<| testList "MergeSources" [

testCaseAsync "and! task x task"
<| asyncEx {
Expand Down

0 comments on commit 133b88a

Please sign in to comment.