Skip to content

Commit

Permalink
don't depend on installed F# for running tests, fixes #357.
Browse files Browse the repository at this point in the history
  • Loading branch information
matthid committed Nov 21, 2015
1 parent e33b758 commit 529838d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
25 changes: 24 additions & 1 deletion build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,29 @@ let testProjects =
[ "FSharp.CodeFormat.Tests"; "FSharp.Literate.Tests";
"FSharp.Markdown.Tests"; "FSharp.MetadataFormat.Tests" ]

Target "WorkaroundInstalledFSharp4_3" (fun _ ->
// Travis has FSharp 4.3 installed and we need 4.4 to execute the tests
// Because FSC always prefers a local FSharp.Core over the installed one
// We just copy it to the nunit-runner
[ "FSharp.Core.dll"; "FSharp.Core.optdata"; "FSharp.Core.sigdata" ]
|> Seq.iter (fun f ->
let source = "packages/FAKE/tools" @@ f
let dest1 = "packages/NUnit.Runners/tools" @@ f
let dest2 = "tests/FSharp.Literate.Tests/bin/Release" @@ f
printfn "Copying %s to %s" source dest1
printfn "Copying %s to %s" source dest2
try
System.IO.File.Copy(source, dest1, true)
System.IO.File.Copy(source, dest2, true)
with e -> printfn "failed to copy: %s" e.Message)
)

Target "PreRunTests" <| ignore

"BuildTests"
==> "WorkaroundInstalledFSharp4_3"
==> "PreRunTests"

Target "RunTests" <| ignore

// For each test project file, generate a new "RunTest_Xyz" which
Expand All @@ -184,7 +207,7 @@ for name in testProjects do
Framework = "4.0"
OutputFile = "TestResults.xml" })
taskName ==> "RunTests" |> ignore
"BuildTests" ==> taskName |> ignore
"PreRunTests" ==> taskName |> ignore

// --------------------------------------------------------------------------------------
// Build a NuGet package
Expand Down
2 changes: 1 addition & 1 deletion tests/FSharp.Literate.Tests/Tests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ do

// Test that everything works
Logging.infof "FSharp.Formatting Logging setup!"
Yaaf.FSharp.Scripting.Log.infof "Yaaf.FSharp.Scripting Logging setup!"
Yaaf.FSharp.Scripting.Log.infof "Yaaf.FSharp.Scripting Logging setup (BaseDirectory: %s)!" System.AppDomain.CurrentDomain.BaseDirectory
with e ->
printfn "FSharp.Formatting Logging setup failed: %A" e

Expand Down

0 comments on commit 529838d

Please sign in to comment.