Skip to content

Commit 0509d97

Browse files
committed
Fix Fable tests
1 parent e0975fa commit 0509d97

File tree

2 files changed

+28
-6
lines changed

2 files changed

+28
-6
lines changed

src/FsToolkit.ErrorHandling/Async.fs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,23 @@ module Async =
126126
(input1: Async<'input1>)
127127
(input2: Async<'input2>)
128128
: Async<'output> =
129+
130+
#if FABLE_COMPILER && FABLE_COMPILER_PYTHON
131+
Async.Parallel(
132+
[|
133+
map box input1
134+
map box input2
135+
|]
136+
)
137+
#else
129138
Async.Parallel(
130139
[|
131140
map box input1
132141
map box input2
133142
|],
134143
maxDegreeOfParallelism = 2
135144
)
145+
#endif
136146
|> map (fun results ->
137147
let a =
138148
results[0]
@@ -159,6 +169,15 @@ module Async =
159169
(input2: Async<'input2>)
160170
(input3: Async<'input3>)
161171
: Async<'output> =
172+
#if FABLE_COMPILER && FABLE_COMPILER_PYTHON
173+
Async.Parallel(
174+
[|
175+
map box input1
176+
map box input2
177+
map box input3
178+
|]
179+
)
180+
#else
162181
Async.Parallel(
163182
[|
164183
map box input1
@@ -167,6 +186,7 @@ module Async =
167186
|],
168187
maxDegreeOfParallelism = 3
169188
)
189+
#endif
170190
|> map (fun results ->
171191
let a =
172192
results[0]

tests/FsToolkit.ErrorHandling.Tests/TestHelpers.fs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,17 @@ namespace FsToolkit.ErrorHandling
33
[<RequireQualifiedAccess>]
44
module Async =
55

6+
open System
7+
68
/// An Async that never completes but can be cancelled
79
let never<'a> : Async<'a> =
8-
async {
9-
let! ct = Async.CancellationToken
10-
11-
let! _ = Async.AwaitWaitHandle(ct.WaitHandle)
10+
let rec loop () =
11+
async {
12+
do! Async.Sleep(TimeSpan.FromHours 1)
13+
return! loop ()
14+
}
1215

13-
return failwith "Unreachable"
14-
}
16+
loop ()
1517

1618
module TestHelpers =
1719
let makeDisposable (callback) =

0 commit comments

Comments
 (0)