Skip to content

Commit

Permalink
Should fix all the build breaks
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveGilham committed Jan 11, 2021
1 parent 8a724a4 commit 11fe954
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 1 deletion.
3 changes: 2 additions & 1 deletion AltCover.Engine/Tasks.fs
Expand Up @@ -392,7 +392,8 @@ type RunSettings() =

type ContingentCopy() =
inherit Task(null)

[<SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly",
Justification="The name of the MSBuild property to use")>]
member val RelativeDir = String.Empty with get, set
member val CopyToOutputDirectory = String.Empty with get, set

Expand Down
2 changes: 2 additions & 0 deletions Build/targets.fsx
Expand Up @@ -3648,6 +3648,7 @@ _Target "ApiUse" (fun _ ->
fsproj.Save "./_ApiUse/_DotnetTest/dotnettest.fsproj"
Shell.copy "./_ApiUse/_DotnetTest" (!!"./Sample4/*.fs")
Shell.copy "./_ApiUse/_DotnetTest" (!!"./Sample4/*.json")
Shell.copyDir "./_ApiUse/_DotnetTest/Data" "./Sample4/Data" File.Exists

let config = """<?xml version="1.0" encoding="utf-8"?>
<configuration>
Expand Down Expand Up @@ -4483,6 +4484,7 @@ _Target "DotnetGlobalIntegration" (fun _ ->
fsproj.Save "./_DotnetGlobalTest/dotnetglobal.fsproj"
Shell.copy "./_DotnetGlobalTest" (!!"./Sample4/*.fs")
Shell.copy "./_DotnetGlobalTest" (!!"./Sample4/*.json")
Shell.copyDir "./_DotnetGlobalTest/Data" "./Sample4/Data" File.Exists

Actions.RunDotnet (fun o' -> { dotnetOptions o' with WorkingDirectory = working })
"tool"
Expand Down
1 change: 1 addition & 0 deletions Tests/Expecto.fs
Expand Up @@ -457,6 +457,7 @@ module ExpectoTestManifest =
Tests.AltCoverTests3.RunSettingsExtendsOK, "Tests3.RunSettingsExtendsOK"
Tests.AltCoverTests3.RunSettingsRecoversOK, "Tests3.RunSettingsRecoversOK"
Tests.AltCoverTests3.RunSettingsThrowsIfUninitialized, "Tests3.RunSettingsThrowsIfUninitialized"
Tests.AltCoverTests3.ContingentCopyTest, "Tests3.ContingentCopyTest"
Tests.AltCoverXTests.CollectOptionsCanBeValidated, "XTests.CollectOptionsCanBeValidated"
Tests.AltCoverXTests.TypeSafeEmptyThresholdCanBeValidated, "XTests.TypeSafeEmptyThresholdCanBeValidated"
Tests.AltCoverXTests.TypeSafeCollectOptionsCanBeValidated, "XTests.TypeSafeCollectOptionsCanBeValidated"
Expand Down
36 changes: 36 additions & 0 deletions Tests/Tests3.fs
Expand Up @@ -2921,4 +2921,40 @@ module AltCoverTests3 =
Assembly.GetExecutingAssembly().Location,
String.Empty,
Assembly.GetExecutingAssembly().FullName)).Replace("\r", String.Empty)))

[<Test>]
let ContingentCopyTest() =
Main.init()
let subject = ContingentCopy()
let unique = Guid.NewGuid().ToString()

let where = Assembly.GetExecutingAssembly().Location |> Path.GetDirectoryName
let relative = where |> Path.GetFileName

subject.BuildOutputDirectory <- where |> Path.GetDirectoryName
subject.InstrumentDirectory <- Path.Combine(where, unique)
subject.FileName <- "Sample2.pdb"

let from = Path.Combine(subject.BuildOutputDirectory, relative, subject.FileName)
test <@ from |> File.Exists @>

test <@ subject.InstrumentDirectory |> Directory.Exists |> not @>

test <@ subject.Execute() @>
test <@ subject.InstrumentDirectory |> Directory.Exists |> not @>

subject.RelativeDir <- relative
test <@ subject.Execute() @>
test <@ subject.InstrumentDirectory |> Directory.Exists |> not @>

subject.RelativeDir <- String.Empty
subject.CopyToOutputDirectory <- "Always"
test <@ subject.Execute() @>
test <@ subject.InstrumentDirectory |> Directory.Exists |> not @>

subject.RelativeDir <- relative
test <@ subject.Execute() @>
let target = Path.Combine(subject.InstrumentDirectory, relative, subject.FileName)
test <@ target |> File.Exists @>

// Recorder.fs => Recorder.Tests

0 comments on commit 11fe954

Please sign in to comment.