Skip to content

Commit be207c0

Browse files
committed
Cleanup
1 parent 081ee3b commit be207c0

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

src/FSharp.Control.TaskSeq.Test/Nunit.Extensions.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ module ExtraCustomMatchers =
134134

135135
CustomMatcher<obj>(
136136
$"Throws %s{ex.Name} (Below, XUnit does not show actual value properly)",
137-
(fun fn -> (testForThrowing (fn :?> (unit -> Task))).Result)
137+
(fun fn -> (testForThrowing (fn :?> unit -> Task)).Result)
138138
)
139139

140140
/// <summary>
@@ -170,7 +170,7 @@ module ExtraCustomMatchers =
170170

171171
CustomMatcher<obj>(
172172
$"Throws %s{ex.Name} (Below, XUnit does not show actual value properly)",
173-
(fun fn -> (testForThrowing (fn :?> (unit -> Task))).Result)
173+
(fun fn -> (testForThrowing (fn :?> unit -> Task)).Result)
174174
)
175175

176176
let inline assertThrows ty (f: unit -> 'U) = f >> ignore |> should throw ty

src/FSharp.Control.TaskSeq.Test/TestUtils.fs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -95,23 +95,25 @@ type DummyTaskFactory(µsecMin: int64<µs>, µsecMax: int64<µs>) =
9595
/// <summary>
9696
/// Creates dummy tasks with a randomized delay and a mutable state,
9797
/// to ensure we properly test whether processing is done ordered or not.
98-
/// Uses the defaults for <paramref name="µsecMin" /> and <paramref name="µsecMax" />
98+
/// Uses the defaults for <paramref name="minMs" /> and <paramref name="maxMs" />
9999
/// with 10,000µs and 30,000µs respectively (or 10ms and 30ms).
100100
/// </summary>
101-
new() = new DummyTaskFactory(10_000L<µs>, 30_000L<µs>)
101+
new() = DummyTaskFactory(10_000L<µs>, 30_000L<µs>)
102102

103103
/// <summary>
104104
/// Creates dummy tasks with a randomized delay and a mutable state,
105105
/// to ensure we properly test whether processing is done ordered or not.
106-
/// Values <paramref name="msecMin" /> and <paramref name="msecMax" /> can be
106+
/// Values <paramref name="minMs" /> and <paramref name="maxMs" /> can be
107107
/// given in milliseconds.
108108
/// </summary>
109-
new(msecMin: int<ms>, msecMax: int<ms>) = new DummyTaskFactory(int64 msecMin * 1000L<µs>, int64 msecMax * 1000L<µs>)
109+
/// <param name="minMs">Minimum delay</param>
110+
/// <param name="maxMs">Maximum delay</param>
111+
new(minMs: int<ms>, maxMs: int<ms>) = DummyTaskFactory(int64 minMs * 1000L<µs>, int64 maxMs * 1000L<µs>)
110112

111113

112114
/// Bunch of delayed tasks that randomly have a yielding delay of 10-30ms, therefore having overlapping execution times.
113115
member _.CreateDelayedTasks_SideEffect total = [
114-
for i in 0 .. total - 1 do
116+
for _ in 0 .. total - 1 do
115117
fun () -> runTaskDelayed ()
116118
]
117119

@@ -123,7 +125,7 @@ type DummyTaskFactory(µsecMin: int64<µs>, µsecMax: int64<µs>) =
123125

124126
/// Bunch of delayed tasks without internally using Task.Delay, therefore hot-started and immediately finished.
125127
member _.CreateDirectTasks_SideEffect total = [
126-
for i in 0 .. total - 1 do
128+
for _ in 0 .. total - 1 do
127129
fun () -> runTaskDirect ()
128130
]
129131

@@ -316,10 +318,10 @@ module TestUtils =
316318
let getEmptyVariant variant : IAsyncEnumerable<int> =
317319
match variant with
318320
| EmptyVariant.CallEmpty -> TaskSeq.empty
319-
| EmptyVariant.Do -> taskSeq { do ignore () }
321+
| EmptyVariant.Do -> taskSeq { do () }
320322
| EmptyVariant.DoBang -> taskSeq { do! task { return () } }
321323
| EmptyVariant.YieldBang -> taskSeq { yield! Seq.empty<int> }
322-
| EmptyVariant.YieldBangNested -> taskSeq { yield! taskSeq { do ignore () } }
324+
| EmptyVariant.YieldBangNested -> taskSeq { yield! taskSeq { do () } }
323325
| EmptyVariant.DelayDoBang -> taskSeq {
324326
do! microDelay ()
325327
do! microDelay ()
@@ -468,7 +470,7 @@ module TestUtils =
468470

469471
| SeqWithSideEffect.Sequential_For -> taskSeq {
470472
// F# BUG? coloring disappears?
471-
for x = 0 to 9 do
473+
for _ = 0 to 9 do
472474
i <- i + 1
473475
yield i
474476
}
@@ -528,7 +530,7 @@ module TestUtils =
528530
/// Will add 1 to the passed integer upon disposing.
529531
let getEmptyDisposableTaskSeq (disposed: int ref) =
530532
{ new IAsyncEnumerable<'T> with
531-
member _.GetAsyncEnumerator(_) =
533+
member _.GetAsyncEnumerator _ =
532534
{ new IAsyncEnumerator<'T> with
533535
member _.MoveNextAsync() = ValueTask.False
534536
member _.Current = Unchecked.defaultof<'T>
@@ -540,7 +542,7 @@ module TestUtils =
540542
/// The singleton value is '42'. Will add 1 to the passed integer upon disposing.
541543
let getSingletonDisposableTaskSeq (disposed: int ref) =
542544
{ new IAsyncEnumerable<int> with
543-
member _.GetAsyncEnumerator(_) =
545+
member _.GetAsyncEnumerator _ =
544546
let mutable status = BeforeAll
545547

546548
{ new IAsyncEnumerator<int> with

0 commit comments

Comments
 (0)