Skip to content

Commit 23740cd

Browse files
committed
formatting
1 parent 3fa4689 commit 23740cd

File tree

17 files changed

+115
-39
lines changed

17 files changed

+115
-39
lines changed

src/FsToolkit.ErrorHandling.JobResult/JobOptionCE.fs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ module JobOptionCE =
8888
let mutable doContinue = true
8989
let mutable result = Some()
9090

91-
while doContinue && guard () do
91+
while doContinue
92+
&& guard () do
9293
match! computation with
9394
| Some () -> ()
9495
| None ->

src/FsToolkit.ErrorHandling.JobResult/JobResultCE.fs

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -80,20 +80,26 @@ module JobResultCE =
8080
) : Job<Result<'U, 'TError>> =
8181
job.Using(resource, binder)
8282

83-
member this.While(guard: unit -> bool, computation: Job<Result<unit, 'TError>>) : Job<Result<unit, 'TError>> = job {
84-
let mutable doContinue = true
85-
let mutable result = Ok()
83+
member this.While
84+
(
85+
guard: unit -> bool,
86+
computation: Job<Result<unit, 'TError>>
87+
) : Job<Result<unit, 'TError>> =
88+
job {
89+
let mutable doContinue = true
90+
let mutable result = Ok()
8691

87-
while doContinue && guard () do
88-
match! computation with
89-
| Ok () -> ()
90-
| Error e ->
91-
doContinue <- false
92-
result <- Error e
92+
while doContinue
93+
&& guard () do
94+
match! computation with
95+
| Ok () -> ()
96+
| Error e ->
97+
doContinue <- false
98+
result <- Error e
9399

94-
return result
100+
return result
95101

96-
}
102+
}
97103

98104
member inline this.For
99105
(

src/FsToolkit.ErrorHandling/OptionCE.fs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ module OptionCE =
7777
let mutable doContinue = true
7878
let mutable result = Some()
7979

80-
while doContinue && guard () do
80+
while doContinue
81+
&& guard () do
8182
match generator () with
8283
| Some () -> ()
8384
| None ->

src/FsToolkit.ErrorHandling/ResultCE.fs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ module ResultCE =
7878
let mutable doContinue = true
7979
let mutable result = Ok()
8080

81-
while doContinue && guard () do
81+
while doContinue
82+
&& guard () do
8283
match generator () with
8384
| Ok () -> ()
8485
| Error e ->
@@ -94,7 +95,11 @@ module ResultCE =
9495
) : Result<unit, 'TError> =
9596
this.Using(
9697
sequence.GetEnumerator(),
97-
fun enum -> this.While((fun () -> enum.MoveNext()), this.Delay(fun () -> binder enum.Current))
98+
fun enum ->
99+
this.While(
100+
(fun () -> enum.MoveNext()),
101+
this.Delay(fun () -> binder enum.Current)
102+
)
98103
)
99104

100105
member inline _.BindReturn

src/FsToolkit.ErrorHandling/ValidationCE.fs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ module ValidationCE =
7777
let mutable doContinue = true
7878
let mutable result = Ok()
7979

80-
while doContinue && guard () do
80+
while doContinue
81+
&& guard () do
8182
match generator () with
8283
| Ok () -> ()
8384
| Error e ->

src/FsToolkit.ErrorHandling/ValueOptionCE.fs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ module ValueOptionCE =
7676
let mutable doContinue = true
7777
let mutable result = ValueSome()
7878

79-
while doContinue && guard () do
79+
while doContinue
80+
&& guard () do
8081
match generator () with
8182
| ValueSome () -> ()
8283
| ValueNone ->

tests/FsToolkit.ErrorHandling.JobResult.Tests/JobOptionCE.fs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,10 @@ let ceTests =
227227
Expect.equal actual (Some data) "Should be ok"
228228
}
229229
yield! [
230-
let maxIndices = [ 10; 1000000 ]
230+
let maxIndices = [
231+
10
232+
1000000
233+
]
231234

232235
for maxIndex in maxIndices do
233236
testCaseJob
@@ -272,7 +275,10 @@ let ceTests =
272275
let! actual = jobOption {
273276
while loopCount < data.Length do
274277
let! x = data.[loopCount]
275-
loopCount <- loopCount + 1
278+
279+
loopCount <-
280+
loopCount
281+
+ 1
276282

277283
return sideEffect ()
278284
}

tests/FsToolkit.ErrorHandling.JobResult.Tests/JobResultCE.fs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,10 @@ let ``JobResultCE using Tests`` =
290290
let ``JobResultCE loop Tests`` =
291291
testList "JobResultCE loop Tests" [
292292
yield! [
293-
let maxIndices = [ 10; 1000000 ]
293+
let maxIndices = [
294+
10
295+
1000000
296+
]
294297

295298
for maxIndex in maxIndices do
296299
testCaseJob
@@ -335,7 +338,10 @@ let ``JobResultCE loop Tests`` =
335338
let! actual = jobResult {
336339
while loopCount < data.Length do
337340
let! x = data.[loopCount]
338-
loopCount <- loopCount + 1
341+
342+
loopCount <-
343+
loopCount
344+
+ 1
339345

340346
return sideEffect ()
341347
}

tests/FsToolkit.ErrorHandling.TaskResult.Tests/BackgroundTaskResultCE.fs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,10 @@ let ``BackgroundTaskResultCE using Tests`` =
349349
let ``BackgroundTaskResultCE loop Tests`` =
350350
testList "BackgroundTaskResultCE loop Tests" [
351351
yield! [
352-
let maxIndices = [ 10; 1000000 ]
352+
let maxIndices = [
353+
10
354+
1000000
355+
]
353356

354357
for maxIndex in maxIndices do
355358
testCaseTask

tests/FsToolkit.ErrorHandling.TaskResult.Tests/TaskOptionCE.fs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,10 @@ let ceTests =
282282
Expect.equal actual (Some data) "Should be ok"
283283
}
284284
yield! [
285-
let maxIndices = [ 10; 1000000 ]
285+
let maxIndices = [
286+
10
287+
1000000
288+
]
286289

287290
for maxIndex in maxIndices do
288291
testCaseTask
@@ -321,7 +324,12 @@ let ceTests =
321324
return index
322325
}
323326

324-
Expect.equal index (items.Length - 1) "Index should reach maxIndex"
327+
Expect.equal
328+
index
329+
(items.Length
330+
- 1)
331+
"Index should reach maxIndex"
332+
325333
Expect.equal actual (None) "Should be NOPE"
326334
}
327335
testCaseTask "while fail"

tests/FsToolkit.ErrorHandling.TaskResult.Tests/TaskResultCE.fs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,10 @@ let ``TaskResultCE using Tests`` =
364364
let ``TaskResultCE loop Tests`` =
365365
testList "TaskResultCE loop Tests" [
366366
yield! [
367-
let maxIndices = [ 10; 1000000 ]
367+
let maxIndices = [
368+
10
369+
1000000
370+
]
368371

369372
for maxIndex in maxIndices do
370373
testCaseTask

tests/FsToolkit.ErrorHandling.Tests/AsyncOptionCE.fs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,10 @@ let ceTests =
210210
Expect.equal actual (Some data) "Should be ok"
211211
}
212212
yield! [
213-
let maxIndices = [ 10; 1000000 ]
213+
let maxIndices = [
214+
10
215+
1000000
216+
]
214217

215218
for maxIndex in maxIndices do
216219
testCaseAsync
@@ -237,7 +240,6 @@ let ceTests =
237240
let mutable index = 0
238241

239242

240-
241243
let mutable loopCount = 0
242244
let mutable wasCalled = false
243245

@@ -259,7 +261,10 @@ let ceTests =
259261
let! actual = asyncOption {
260262
while loopCount < data.Length do
261263
let! x = data.[loopCount]
262-
loopCount <- loopCount + 1
264+
265+
loopCount <-
266+
loopCount
267+
+ 1
263268

264269
return sideEffect ()
265270
}

tests/FsToolkit.ErrorHandling.Tests/AsyncResultCE.fs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,10 @@ let ``AsyncResultCE loop Tests`` =
308308
Expect.equal actual (Result.Ok data) "Should be ok"
309309
}
310310
yield! [
311-
let maxIndices = [ 10; 1000000 ]
311+
let maxIndices = [
312+
10
313+
1000000
314+
]
312315

313316
for maxIndex in maxIndices do
314317
testCaseAsync
@@ -353,7 +356,10 @@ let ``AsyncResultCE loop Tests`` =
353356
let! actual = asyncResult {
354357
while loopCount < data.Length do
355358
let! x = data.[loopCount]
356-
loopCount <- loopCount + 1
359+
360+
loopCount <-
361+
loopCount
362+
+ 1
357363

358364
return sideEffect ()
359365
}

tests/FsToolkit.ErrorHandling.Tests/OptionCE.fs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,10 @@ let ceTests =
127127

128128
Expect.equal actual (Some data) "Should be ok"
129129
yield! [
130-
let maxIndices = [ 10; 1000000 ]
130+
let maxIndices = [
131+
10
132+
1000000
133+
]
131134

132135
for maxIndex in maxIndices do
133136
testCase
@@ -171,7 +174,10 @@ let ceTests =
171174
let actual = option {
172175
while loopCount < data.Length do
173176
let! x = data.[loopCount]
174-
loopCount <- loopCount + 1
177+
178+
loopCount <-
179+
loopCount
180+
+ 1
175181

176182
return sideEffect ()
177183
}
@@ -181,7 +187,6 @@ let ceTests =
181187
Expect.isFalse wasCalled "No additional side effects should occur"
182188

183189

184-
185190
testCase "For in"
186191
<| fun () ->
187192
let data = 42

tests/FsToolkit.ErrorHandling.Tests/ResultCE.fs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,11 @@ let ``ResultCE using Tests`` =
234234
let ``ResultCE loop Tests`` =
235235
testList "ResultCE loop Tests" [
236236
yield! [
237-
let maxIndices = [ 10; 10000; 1000000 ]
237+
let maxIndices = [
238+
10
239+
10000
240+
1000000
241+
]
238242

239243
for maxIndex in maxIndices do
240244
testCase
@@ -278,7 +282,10 @@ let ``ResultCE loop Tests`` =
278282
let actual = result {
279283
while loopCount < data.Length do
280284
let! x = data.[loopCount]
281-
loopCount <- loopCount + 1
285+
286+
loopCount <-
287+
loopCount
288+
+ 1
282289

283290
return sideEffect ()
284291
}

tests/FsToolkit.ErrorHandling.Tests/ValidationCE.fs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,10 @@ let ``ValidationCE using Tests`` =
278278
let ``ValidationCE loop Tests`` =
279279
testList "ValidationCE loop Tests" [
280280
yield! [
281-
let maxIndices = [ 10; 1000000 ]
281+
let maxIndices = [
282+
10
283+
1000000
284+
]
282285

283286
for maxIndex in maxIndices do
284287
testCase
@@ -322,7 +325,10 @@ let ``ValidationCE loop Tests`` =
322325
let actual = validation {
323326
while loopCount < data.Length do
324327
let! x = data.[loopCount]
325-
loopCount <- loopCount + 1
328+
329+
loopCount <-
330+
loopCount
331+
+ 1
326332

327333
return sideEffect ()
328334
}

tests/FsToolkit.ErrorHandling.Tests/ValueOptionCE.fs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,10 @@ let ceTests =
130130

131131
Expect.equal actual (ValueSome data) "Should be ok"
132132
yield! [
133-
let maxIndices = [ 10; 1000000 ]
133+
let maxIndices = [
134+
10
135+
1000000
136+
]
134137

135138
for maxIndex in maxIndices do
136139
testCase
@@ -175,7 +178,10 @@ let ceTests =
175178
let actual = voption {
176179
while loopCount < data.Length do
177180
let! x = data.[loopCount]
178-
loopCount <- loopCount + 1
181+
182+
loopCount <-
183+
loopCount
184+
+ 1
179185

180186
return sideEffect ()
181187
}

0 commit comments

Comments
 (0)