Skip to content

Commit

Permalink
SDK/tool updates - mostly working around NUnit 4.0 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveGilham committed Dec 30, 2023
1 parent bdfaf9a commit e7c8ccc
Show file tree
Hide file tree
Showing 21 changed files with 115 additions and 56 deletions.
4 changes: 2 additions & 2 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
]
},
"altcode.gendarme-tool": {
"version": "2023.8.26.15512",
"version": "2023.12.27.19054",
"commands": [
"gendarme"
]
},
"dotnet-fsharplint": {
"version": "0.21.3",
"version": "0.23.0",
"commands": [
"dotnet-fsharplint"
]
Expand Down
3 changes: 2 additions & 1 deletion AltCover.Api.Tests/AltCover.Api.Tests.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="NUnit" />
<PackageReference Include="NUnit" Condition="'$(TargetFramework)' != 'net472'" />
<PackageReference Include="NUnit" VersionOverride="3.14.0" Condition="'$(TargetFramework)' == 'net472'" />
<PackageReference Include="YoloDev.Expecto.TestSdk" Condition="'$(TargetFramework)' != 'net472'" />
<PackageReference Include="FSharp.Core">
<ExcludeAssets>contentfiles</ExcludeAssets>
Expand Down
6 changes: 3 additions & 3 deletions AltCover.Avalonia/AltCover.Avalonia.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Avalonia" />
<PackageReference Include="Avalonia.Desktop" />
<PackageReference Include="MessageBox.Avalonia" />
<PackageReference Include="Avalonia" VersionOverride="0.10.18" />
<PackageReference Include="Avalonia.Desktop" VersionOverride="0.10.18" />
<PackageReference Include="MessageBox.Avalonia" VersionOverride="2.1.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
Expand Down
10 changes: 5 additions & 5 deletions AltCover.Avalonia/AltCover.Avalonia11.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Avalonia" VersionOverride="11.0.5" />
<PackageReference Include="Avalonia.Desktop" VersionOverride="11.0.5" />
<PackageReference Include="Avalonia.Themes.Fluent" VersionOverride="11.0.5" />
<PackageReference Include="Avalonia.Themes.Simple" VersionOverride="11.0.5" />
<PackageReference Include="MessageBox.Avalonia" VersionOverride="3.1.5.1" />
<PackageReference Include="Avalonia" />
<PackageReference Include="Avalonia.Desktop" />
<PackageReference Include="Avalonia.Themes.Fluent" />
<PackageReference Include="Avalonia.Themes.Simple" />
<PackageReference Include="MessageBox.Avalonia" />
<PackageReference Include="Microsoft.SourceLink.GitHub">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
Expand Down
3 changes: 2 additions & 1 deletion AltCover.Monitor.Tests/AltCover.Monitor.Tests.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
<ItemGroup>
<PackageReference Include="Expecto" Condition="'$(TargetFramework)' != 'net472'" />
<PackageReference Include="Expecto.TestResults" Condition="'$(TargetFramework)' != 'net472'" />
<PackageReference Include="NUnit" />
<PackageReference Include="NUnit" Condition="'$(TargetFramework)' != 'net472'" />
<PackageReference Include="NUnit" VersionOverride="3.14.0" Condition="'$(TargetFramework)' == 'net472'" />
<PackageReference Include="NUnit3TestAdapter" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="Unquote" Condition="'$(TargetFramework)' != 'net472'" />
Expand Down
2 changes: 1 addition & 1 deletion AltCover.Recorder.Tests/AltCover.Recorder.Tests.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' != 'net20'">
<PackageReference Include="NUnit" />
<PackageReference Include="NUnit" VersionOverride="3.14.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net20'">
Expand Down
2 changes: 1 addition & 1 deletion AltCover.Recorder2.Tests/AltCover.Recorder2.Tests.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="NUnit" />
<PackageReference Include="NUnit" VersionOverride="3.14.0" />
<PackageReference Include="NUnit3TestAdapter">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
3 changes: 2 additions & 1 deletion AltCover.Tests/AltCover.Tests.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@
<HintPath>..\ThirdParty\Mono.Options.dll</HintPath>
</Reference>
<PackageReference Include="Newtonsoft.Json" />
<PackageReference Include="NUnit" />
<PackageReference Include="NUnit" Condition="'$(TargetFramework)' != 'net472'" />
<PackageReference Include="NUnit" VersionOverride="3.14.0" Condition="'$(TargetFramework)' == 'net472'" />
<PackageReference Include="System.Security.Permissions" />
<PackageReference Include="FSharp.Core">
<ExcludeAssets>contentfiles</ExcludeAssets>
Expand Down
52 changes: 49 additions & 3 deletions AltCover.Tests/TestCommon.fs
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,8 @@ Actual: False
// printfn "%s" fallback
// printfn "*********************************************"

Assert.That(
fallback,
Does.EndWith
let expected =
#if NET472
""" actual = expected
"yes" = "no"
false
Expand All @@ -185,6 +184,26 @@ false
But was: "yes"
-----------^
"""
#else
""" actual = expected
"yes" = "no"
false""" + "\n" + """Assert.That(, )
Expected string length 2 but was 3. Strings differ at index 0.
Expected: "no"
But was: "yes"
-----------^
"""
#endif

Assert.That(
fallback,
Does.EndWith expected

//,"VV*********************************************" + Environment.NewLine +
//fallback.TrimEnd() + Environment.NewLine +
//"^^*********************************************" + Environment.NewLine +
//(sprintf "%A %A" fallback.Length expected.Length) +
//"^^*********************************************" + Environment.NewLine
)

let m =
Expand Down Expand Up @@ -212,6 +231,7 @@ Actual: False
Assert.That(
m2,
Is.EqualTo(
#if NET472
"""Multiple failures or warnings in test:
1) Expected: 4
But was: 3
Expand All @@ -234,6 +254,32 @@ false
false
"""
#else
"""Multiple failures or warnings in test:
1) Assert.That(, )
Expected: 4
But was: 3
2)@
3 = exp1
3 = 4
false
3) Assert.That(, )
Expected string length 2 but was 3. Strings differ at index 0.
Expected: "no"
But was: "yes"
-----------^
4)@
"yes" = exp2
"yes" = "no"
false
"""
#endif
.Replace("@", " ")
)
)
Expand Down
4 changes: 2 additions & 2 deletions AltCover.Tests/Tests2.fs
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ module AltCoverTests2 =

Assert.That(token', Is.EqualTo("4ebffcaabf10ce6a"))

Assert.True(
Assert.That(
prepared.CustomAttributes
|> Seq.exists (fun a ->
a.AttributeType.FullName = "AltCover.Recorder.InstrumentationAttribute"),
Expand Down Expand Up @@ -973,7 +973,7 @@ has been prefixed with Ldc_I4_1 (1 byte)

rescope.Scopes.Add rescope

Assert.True(InstructionOffset().IsEndOfMethod, "End should go to none")
Assert.That (InstructionOffset().IsEndOfMethod, "End should go to none")

// prune 1 recursion and 2 at end => 3
Assert.That(rescope.Scopes |> Seq.length, Is.EqualTo(4 + 3))
Expand Down
15 changes: 9 additions & 6 deletions AltCover.Tests/Tests3.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1067,17 +1067,20 @@ module AltCoverTests3 =
let pcom a b =
Path.Combine(b, a) |> canonicalDirectory

let AssertAreEqual (a:obj, b:obj) =
Assert.That(a, Is.EqualTo b)

match parse with
| Right _ ->
CoverageParameters.inputDirectories ()
|> Seq.toList
|> List.zip ([ "."; ".." ] |> List.map canonicalDirectory)
|> List.iter Assert.AreEqual
|> List.iter AssertAreEqual

CoverageParameters.outputDirectories ()
|> Seq.toList
|> List.zip ([ "."; ".." ] |> List.map (pcom "__Instrumented"))
|> List.iter Assert.AreEqual
|> List.iter AssertAreEqual

CoverageParameters.inplace.Value <- true
CoverageParameters.theOutputDirectories.Add "maybe"
Expand All @@ -1087,7 +1090,7 @@ module AltCoverTests3 =
|> List.zip
[ canonicalDirectory "maybe"
".." |> (pcom "__Saved") ]
|> List.iter Assert.AreEqual
|> List.iter AssertAreEqual

finally
CoverageParameters.theOutputDirectories.Clear()
Expand Down Expand Up @@ -3300,7 +3303,7 @@ module AltCoverTests3 =
let result =
Main.I.screenAssembly (Path.GetFileName f) def

Assert.True(result |> Option.isSome, f))
Assert.That(result |> Option.isSome, f))

Assert.That(sb.ToString(), Is.Empty)

Expand Down Expand Up @@ -3334,14 +3337,14 @@ module AltCoverTests3 =
let s1 =
Main.I.screenAssembly "Sample3.dll" prepared

Assert.True(s1 |> Option.isNone, "Sample3.dll")
Assert.That(s1 |> Option.isNone, "Sample3.dll")

Environment.NewLine |> sb.Append |> ignore

let s1 =
Main.I.screenAssembly "Sample4.dll" assembly

Assert.True(s1 |> Option.isNone, "Sample4.dll")
Assert.That(s1 |> Option.isNone, "Sample4.dll")

let expected =
"Skipping Sample3.dll as it has already been instrumented."
Expand Down
2 changes: 1 addition & 1 deletion AltCover.Tests/XTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,7 @@ module AltCoverXTests =
"xunit.execution.dotnet.dll"
"xunit.runner.reporters.netcoreapp10.dll"
"xunit.runner.utility.netcoreapp10.dll"
"xunit.runner.visualstudio.dotnetcore.testadapter.dll" ]
"xunit.runner.visualstudio.testadapter.dll" ]

let isWindows =
System.Environment.GetEnvironmentVariable("OS") = "Windows_NT"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFrameworks>net8.0;net472</TargetFrameworks>
<IsPackable>false</IsPackable>
<GendarmeVersion>2023.8.26.15512</GendarmeVersion>
<GendarmeVersion>2023.12.27.19054</GendarmeVersion>
<GendarmeToolDir>..\packages\altcode.gendarme\$(GendarmeVersion)\tools\</GendarmeToolDir>
<GenerateProgramFile>false</GenerateProgramFile>
<AssemblyName>AltCover.ValidateGendarmeEmulation</AssemblyName>
Expand Down Expand Up @@ -55,7 +55,8 @@
</PackageReference>
<PackageReference Include="Expecto" Condition="'$(TargetFramework)' != 'net472'" />
<PackageReference Include="Expecto.TestResults" Condition="'$(TargetFramework)' != 'net472'" />
<PackageReference Include="NUnit" />
<PackageReference Include="NUnit" Condition="'$(TargetFramework)' != 'net472'" />
<PackageReference Include="NUnit" VersionOverride="3.14.0" Condition="'$(TargetFramework)' == 'net472'" />
<PackageReference Include="NUnit3TestAdapter">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
3 changes: 2 additions & 1 deletion AltCover.Visualizer.Tests/AltCover.Visualizer.Tests.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="NUnit" />
<PackageReference Include="NUnit" Condition="'$(TargetFramework)' != 'net472'" />
<PackageReference Include="NUnit" VersionOverride="3.14.0" Condition="'$(TargetFramework)' == 'net472'" />
<PackageReference Include="YoloDev.Expecto.TestSdk" Condition="'$(TargetFramework)' != 'net472'" />
<PackageReference Include="Mono.Cecil" />
<PackageReference Include="FSharp.Core">
Expand Down
41 changes: 21 additions & 20 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
<ItemGroup>
<PackageVersion Include="AltCode.Fake.DotNet.Gendarme" Version="5.23.0.42" />
<PackageVersion Include="AltCode.Dixon" Version="2022.12.6.11014" />
<PackageVersion Include="altcode.gendarme" Version="2023.8.26.15512" />
<PackageVersion Include="altcover" Version="8.6.68" />
<PackageVersion Include="AltCover.Api" Version="8.6.68" />
<PackageVersion Include="AltCover.Fake" Version="8.6.68" />
<PackageVersion Include="Avalonia" Version="0.10.18" />
<PackageVersion Include="Avalonia.Desktop" Version="0.10.18" />
<PackageVersion Include="Avalonia.Themes.Fluent" Version="11.0.5" />
<PackageVersion Include="Avalonia.Themes.Simple" Version="11.0.5" />
<PackageVersion Include="altcode.gendarme" Version="2023.12.27.19054" />
<PackageVersion Include="altcover" Version="8.6.95" />
<PackageVersion Include="AltCover.Api" Version="8.6.95" />
<PackageVersion Include="AltCover.Fake" Version="8.6.95" />
<PackageVersion Include="Avalonia" Version="11.0.6" />
<PackageVersion Include="Avalonia.Desktop" Version="11.0.6" />
<PackageVersion Include="Avalonia.Themes.Fluent" Version="11.0.6" />
<PackageVersion Include="Avalonia.Themes.Simple" Version="11.0.6" />
<PackageVersion Include="BlackFox.CommandLine" Version="1.0.0" />
<PackageVersion Include="BlackFox.VsWhere" Version="1.1.0" />
<PackageVersion Include="Cake.Common" Condition="'$(TargetFramework)' == 'netstandard2.0'" Version="1.0.0" />
Expand Down Expand Up @@ -45,8 +45,8 @@
<PackageVersion Include="FuChu" Version="1.1.0" />
<PackageVersion Include="GtkSharp" Version="3.24.24.95" />
<PackageVersion Include="Handlebars.Net" Version="2.1.4" />
<PackageVersion Include="Markdig" Version="0.33.0" />
<PackageVersion Include="MessageBox.Avalonia" Version="2.1.0" />
<PackageVersion Include="Markdig" Version="0.34.0" />
<PackageVersion Include="MessageBox.Avalonia" Version="3.1.5.1" />
<PackageVersion Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="2.1.1" />
<PackageVersion Include="Microsoft.Build.Utilities.Core" Version="16.0.461" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.6.0" />
Expand All @@ -63,7 +63,7 @@
<PackageVersion Include="Nerdbank.GitVersioning" Version="3.6.133" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="NuGet.CommandLine" Version="6.8.0" />
<PackageVersion Include="NUnit" Version="3.14.0" />
<PackageVersion Include="NUnit" Version="4.0.1" />
<PackageVersion Include="NUnit3TestAdapter" Version="4.5.0" />
<!-- This one w/just net20/net40 agents works as before on Linux for the AltCoverRunner test -->
<PackageVersion Include="NUnit.ConsoleRunner" Condition="'$(OS)' != 'Windows_NT'" Version="3.12.0" />
Expand All @@ -76,17 +76,18 @@
<PackageVersion Include="System.IO.Compression" Version="4.3.0" />
<PackageVersion Include="System.Reactive.Core" Version="6.0.0" />
<PackageVersion Include="System.Security.Permissions" Version="8.0.0" />
<PackageVersion Include="Unquote" Version="6.1.0" />
<PackageVersion Include="System.ValueTuple" Version="4.5.0" />
<PackageVersion Include="Unquote" Version="7.0.0" />
<PackageVersion Include="XmlDoc2CmdletDoc" Version="0.4.0-dotnetcore0001" />
<PackageVersion Include="xunit" Version="2.6.2" />
<PackageVersion Include="xunit" Version="2.6.4" />
<PackageVersion Include="xunit.abstractions" Version="2.0.3" />
<PackageVersion Include="xunit.analyzers" Version="1.6.0" />
<PackageVersion Include="xunit.assert" Version="2.6.2" />
<PackageVersion Include="xunit.core" Version="2.6.2" />
<PackageVersion Include="xunit.extensibility.core" Version="2.6.2" />
<PackageVersion Include="xunit.extensibility.execution" Version="2.6.2" />
<PackageVersion Include="xunit.runner.console" Version="2.6.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.4" />
<PackageVersion Include="xunit.analyzers" Version="1.8.0" />
<PackageVersion Include="xunit.assert" Version="2.6.4" />
<PackageVersion Include="xunit.core" Version="2.6.4" />
<PackageVersion Include="xunit.extensibility.core" Version="2.6.4" />
<PackageVersion Include="xunit.extensibility.execution" Version="2.6.4" />
<PackageVersion Include="xunit.runner.console" Version="2.6.4" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.6" />
<PackageVersion Include="YoloDev.Expecto.TestSdk" Version="0.14.3" />
</ItemGroup>
</Project>
3 changes: 2 additions & 1 deletion Samples/Sample2/Sample2.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="NUnit" />
<PackageReference Include="NUnit" Condition="'$(TargetFramework)' != 'net472'" />
<PackageReference Include="NUnit" VersionOverride="3.14.0" Condition="'$(TargetFramework)' == 'net472'" />
<PackageReference Include="NUnit3TestAdapter">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
3 changes: 2 additions & 1 deletion Samples/Sample21/Sample21.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NUnit" />
<PackageReference Include="NUnit" Condition="'$(TargetFramework)' != 'net472'" />
<PackageReference Include="NUnit" VersionOverride="3.14.0" Condition="'$(TargetFramework)' == 'net472'" />
<PackageReference Include="NUnit3TestAdapter" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="coverlet.collector" Condition="'$(TargetFramework)' != 'net472'">
Expand Down
3 changes: 2 additions & 1 deletion Samples/Sample23/Sample23.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="NUnit" />
<PackageReference Include="NUnit" Condition="'$(TargetFramework)' != 'net472'" />
<PackageReference Include="NUnit" VersionOverride="3.14.0" Condition="'$(TargetFramework)' == 'net472'" />
<PackageReference Include="NUnit3TestAdapter" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
</ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion Samples/Sample24/Sample24.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="NUnit" />
<PackageReference Include="NUnit" Condition="'$(TargetFramework)' != 'net472'" />
<PackageReference Include="NUnit" VersionOverride="3.14.0" Condition="'$(TargetFramework)' == 'net472'" />
<PackageReference Include="NUnit3TestAdapter" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
</ItemGroup>
Expand Down
Loading

0 comments on commit e7c8ccc

Please sign in to comment.