Skip to content

Commit c040098

Browse files
committed
Update fsharp.md
1 parent e93381e commit c040098

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

docs/fsharp.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,19 @@ let MyTest () =
3939
<sup><a href='/src/FSharpTests/Tests.fs#L14-L21' title='Snippet source file'>snippet source</a> | <a href='#snippet-fstest' title='Start of snippet'>anchor</a></sup>
4040
<!-- endSnippet -->
4141

42+
Tasks can also be used directly via a `task` computation expression builder, such as the ones included in [Ply](https://github.com/crowded/ply), [TaskBuilder.fs](https://github.com/rspeele/TaskBuilder.fs), or (starting with F# 6.0) FSharp.Core:
43+
44+
<!-- snippet: FsTestTask -->
45+
<a id='snippet-fstesttask'></a>
46+
```fs
47+
[<Fact>]
48+
let MyTaskTest () =
49+
task {
50+
do! Verifier.Verify(15)
51+
}
52+
```
53+
<sup><a href='/src/FSharpTests/Tests.fs#L23-L29' title='Snippet source file'>snippet source</a> | <a href='#snippet-fstesttask' title='Start of snippet'>anchor</a></sup>
54+
<!-- endSnippet -->
4255

4356
## Full tests
4457

@@ -63,6 +76,12 @@ let MyTest () =
6376
.ToTask() |> Async.AwaitTask
6477
}
6578
79+
[<Fact>]
80+
let MyTaskTest () =
81+
task {
82+
do! Verifier.Verify(15)
83+
}
84+
6685
[<Fact>]
6786
let WithFluentSetting () =
6887
async {
@@ -72,5 +91,5 @@ let WithFluentSetting () =
7291
}
7392
do ()
7493
```
75-
<sup><a href='/src/FSharpTests/Tests.fs#L1-L26' title='Snippet source file'>snippet source</a> | <a href='#snippet-FSharpTests/Tests.fs' title='Start of snippet'>anchor</a></sup>
94+
<sup><a href='/src/FSharpTests/Tests.fs#L1-L32' title='Snippet source file'>snippet source</a> | <a href='#snippet-FSharpTests/Tests.fs' title='Start of snippet'>anchor</a></sup>
7695
<!-- endSnippet -->

0 commit comments

Comments
 (0)