Skip to content

Commit 480cf84

Browse files
committed
Add smoketests for NuGet testing
1 parent 035f0e6 commit 480cf84

File tree

4 files changed

+80
-0
lines changed

4 files changed

+80
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net6.0</TargetFramework>
5+
6+
<IsPackable>false</IsPackable>
7+
<GenerateProgramFile>false</GenerateProgramFile>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<Compile Include="SmokeTests.fs" />
12+
<Compile Include="Program.fs" />
13+
</ItemGroup>
14+
15+
<ItemGroup>
16+
<PackageReference Include="FSharp.Control.TaskSeq" Version="0.2.2" />
17+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
18+
<PackageReference Include="xunit" Version="2.4.1" />
19+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
20+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
21+
<PrivateAssets>all</PrivateAssets>
22+
</PackageReference>
23+
<PackageReference Include="coverlet.collector" Version="3.1.2">
24+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
25+
<PrivateAssets>all</PrivateAssets>
26+
</PackageReference>
27+
</ItemGroup>
28+
29+
</Project>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module Program = let [<EntryPoint>] main _ = 0
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
module Tests
2+
3+
open System
4+
open System.Threading.Tasks
5+
open Xunit
6+
open FSharp.Control
7+
8+
[<Fact>]
9+
let ``Use and execute a taskSeq from nuget`` () =
10+
taskSeq { yield 10 }
11+
|> TaskSeq.toArray
12+
|> fun x -> Assert.Equal<int array>(x, [| 10 |])
13+
14+
[<Fact>]
15+
let ``Use and execute a taskSeq from nuget with multiple keywords`` () =
16+
taskSeq {
17+
do! task { do! Task.Delay 10 }
18+
let! x = task { return 1 }
19+
yield x
20+
let! vt = ValueTask<int>(task { return 2 })
21+
yield vt
22+
yield 10
23+
}
24+
|> TaskSeq.toArray
25+
|> fun x -> Assert.Equal<int array>(x, [| 1; 2; 10 |])
26+
27+
// from version 0.3.0:
28+
29+
//[<Fact>]
30+
//let ``Use and execute a taskSeq from nuget with multiple keywords v0.3.0`` () =
31+
// taskSeq {
32+
// do! task { do! Task.Delay 10 }
33+
// do! Task.Delay 10 // only in 0.3
34+
// let! x = task { return 1 } :> Task // only in 0.3
35+
// yield 1
36+
// let! vt = ValueTask<int> ( task { return 2 } )
37+
// yield vt
38+
// let! vt = ValueTask ( task { return 2 } ) // only in 0.3
39+
// do! ValueTask ( task { return 2 } ) // only in 0.3
40+
// yield 3
41+
// yield 10
42+
// }
43+
// |> TaskSeq.toArray
44+
// |> fun x -> Assert.Equal<int array>(x, [| 1; 2; 3; 10 |])

src/FSharp.Control.TaskSeq.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "assets", "assets", "{B198D5
3434
..\assets\taskseq-icon.png = ..\assets\taskseq-icon.png
3535
EndProjectSection
3636
EndProject
37+
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Control.TaskSeq.SmokeTests", "FSharp.Control.TaskSeq.SmokeTests\FSharp.Control.TaskSeq.SmokeTests.fsproj", "{784DAB92-C61A-4A00-890B-E6E3B1805473}"
38+
EndProject
3739
Global
3840
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3941
Debug|Any CPU = Debug|Any CPU
@@ -48,6 +50,10 @@ Global
4850
{06CA2C7E-04DA-4A85-BB8E-4D94BD67AEB3}.Debug|Any CPU.Build.0 = Debug|Any CPU
4951
{06CA2C7E-04DA-4A85-BB8E-4D94BD67AEB3}.Release|Any CPU.ActiveCfg = Release|Any CPU
5052
{06CA2C7E-04DA-4A85-BB8E-4D94BD67AEB3}.Release|Any CPU.Build.0 = Release|Any CPU
53+
{784DAB92-C61A-4A00-890B-E6E3B1805473}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
54+
{784DAB92-C61A-4A00-890B-E6E3B1805473}.Debug|Any CPU.Build.0 = Debug|Any CPU
55+
{784DAB92-C61A-4A00-890B-E6E3B1805473}.Release|Any CPU.ActiveCfg = Release|Any CPU
56+
{784DAB92-C61A-4A00-890B-E6E3B1805473}.Release|Any CPU.Build.0 = Release|Any CPU
5157
EndGlobalSection
5258
GlobalSection(SolutionProperties) = preSolution
5359
HideSolutionNode = FALSE

0 commit comments

Comments
 (0)