-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #85 from TheAngryByrd/test-coverage
Test coverage
- Loading branch information
Showing
12 changed files
with
119 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -254,3 +254,4 @@ paket-files/ | |
TestResults.xml | ||
|
||
dist/ | ||
lcov.info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
namespace MyLib | ||
|
||
module Say = | ||
let nothing name = | ||
name |> ignore | ||
|
||
let hello name = | ||
sprintf "Hello %s" name | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<Project> | ||
<ItemGroup> | ||
<_TargetFramework Include="$(TargetFrameworks)" /> | ||
</ItemGroup> | ||
<UsingTask | ||
TaskName="AltCover.Prepare" | ||
AssemblyFile="../packages/build/altcover/tools/netcoreapp2.0/AltCover.dll"/> | ||
<UsingTask | ||
TaskName="AltCover.Collect" | ||
AssemblyFile="../packages/build/altcover/tools/netcoreapp2.0/AltCover.dll"/> | ||
<Target | ||
Name="InstrumentModulesNoBuild" | ||
BeforeTargets="VSTest" | ||
Condition="$([MSBuild]::EnsureTrailingSlash('$([System.IO.Path]::Combine($(BaseOutputPath),$(Configuration)))')) == '$(OutputPath)'"> | ||
<AltCover.Prepare | ||
ContinueOnError="WarnAndContinue" | ||
Condition="'$(VSTestNoBuild)' == 'true'" | ||
InputDirectory="$(OutputPath)/%(_TargetFramework.Identity)" | ||
OutputDirectory="$(OutputPath)/%(_TargetFramework.Identity)/__Saved$([System.DateTime]::UtcNow.ToString().Replace(':','-').Replace('/','-').Replace(' ','+'))" | ||
XmlReport="$(OutputPath)/%(_TargetFramework.Identity)/_Reports/MSBuildTest.xml" | ||
OpenCover="true" | ||
InPlace="true" | ||
CallContext="@(CallContext)" /> | ||
</Target> | ||
<Target | ||
Name="InstrumentModulesAfterBuild" | ||
AfterTargets="BuildProject" | ||
Condition="$([MSBuild]::EnsureTrailingSlash('$([System.IO.Path]::Combine($(BaseOutputPath),$(Configuration)))')) == '$(OutputPath)'"> | ||
<AltCover.Prepare | ||
ContinueOnError="WarnAndContinue" | ||
Condition="'$(VSTestNoBuild)' != 'true'" | ||
InputDirectory="$(OutputPath)/%(_TargetFramework.Identity)" | ||
OutputDirectory="$(OutputPath)/%(_TargetFramework.Identity)/__Saved$([System.DateTime]::UtcNow.ToString().Replace(':','-').Replace('/','-').Replace(' ','+'))" | ||
XmlReport="$(OutputPath)/%(_TargetFramework.Identity)/_Reports/MSBuildTest.xml" | ||
OpenCover="true" | ||
InPlace="true" | ||
CallContext="@(CallContext)" /> | ||
</Target> | ||
<Target | ||
Name="GenerateCoverageResult" | ||
AfterTargets="VSTest" | ||
Condition="$([MSBuild]::EnsureTrailingSlash('$([System.IO.Path]::Combine($(BaseOutputPath),$(Configuration)))')) != '$(OutputPath)'"> | ||
<AltCover.Collect | ||
ContinueOnError="WarnAndContinue" | ||
RecorderDirectory="$(OutputPath)" | ||
LcovReport="./lcov.info" /> | ||
</Target> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,6 @@ | ||
module ExpectoTemplate | ||
open Expecto | ||
open System.Reflection | ||
|
||
|
||
module AssemblyInfo = | ||
|
||
let metaDataValue (mda : AssemblyMetadataAttribute) = mda.Value | ||
let getMetaDataAttribute (assembly : Assembly) key = | ||
assembly.GetCustomAttributes(typedefof<AssemblyMetadataAttribute>) | ||
|> Seq.cast<AssemblyMetadataAttribute> | ||
|> Seq.find(fun x -> x.Key = key) | ||
|
||
let getReleaseDate assembly = | ||
"ReleaseDate" | ||
|> getMetaDataAttribute assembly | ||
|> metaDataValue | ||
|
||
let getGitHash assembly = | ||
"GitHash" | ||
|> getMetaDataAttribute assembly | ||
|> metaDataValue | ||
|
||
[<EntryPoint>] | ||
let main argv = | ||
if argv |> Seq.contains ("--version") then | ||
let assembly = Assembly.GetEntryAssembly() | ||
let name = assembly.GetName() | ||
let version = assembly.GetName().Version | ||
let releaseDate = AssemblyInfo.getReleaseDate assembly | ||
let githash = AssemblyInfo.getGitHash assembly | ||
printfn "%s - %A - %s - %s" name.Name version releaseDate githash | ||
Tests.runTestsInAssembly defaultConfig argv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="AssemblyInfo.fs" /> | ||
<Compile Include="Tests.fs" /> | ||
<Compile Include="Main.fs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="../../src/MyLib/MyLib.fsproj" /> | ||
</ItemGroup> | ||
<Import Project="..\..\.paket\Paket.Restore.targets" /> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="AssemblyInfo.fs" /> | ||
<Compile Include="Tests.fs" /> | ||
<Compile Include="Main.fs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="../../src/MyLib/MyLib.fsproj" /> | ||
</ItemGroup> | ||
<Import Project="..\..\.paket\Paket.Restore.targets" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters