Skip to content

Commit

Permalink
Addresses issue fsprojects#2199 -- Make the obvious Windows-only tool…
Browse files Browse the repository at this point in the history
…s fail explicitly off the supported platform
  • Loading branch information
SteveGilham committed Nov 15, 2018
1 parent 6ed49b4 commit ecdf0bf
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 6 deletions.
4 changes: 3 additions & 1 deletion src/app/Fake.DotNet.FxCop/FxCop.fs
Original file line number Diff line number Diff line change
Expand Up @@ -226,4 +226,6 @@ let run param (assemblies : string seq) =
composeCommandLine param assemblies
|> Proc.run
|> failAsrequired param
__.MarkSuccess()
__.MarkSuccess()
else
raise <| NotSupportedException("FxCop is currently not supported on mono")
4 changes: 3 additions & 1 deletion src/app/Fake.DotNet.ILMerge/ILMerge.fs
Original file line number Diff line number Diff line change
Expand Up @@ -179,4 +179,6 @@ let run parameters outputFile primaryAssembly =
if 0 <> run.ExitCode then
let args = getArguments outputFile primaryAssembly parameters
failwithf "'ILMerge %s' failed." (String.separated " " args)
__.MarkSuccess()
__.MarkSuccess()
else
raise <| NotSupportedException("ILMerge is currently not supported on mono")
12 changes: 10 additions & 2 deletions src/test/Fake.Core.UnitTests/Fake.DotNet.FxCop.fs
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,15 @@ let testCases =
printfn "Unexpected failure %A level=%d index=%d" x level
mapIndex
reraise()) ]
else []
else
[ testCase "Test failure on non-Windows platforms" <| fun _ ->
let p = FxCop.Params.Create()
Expect.throwsC (fun () -> FxCop.run p [])
(fun ex ->
Expect.equal (ex.GetType()) typeof<NotSupportedException>
"Exception type should be as expected"
Expect.equal ex.Message "FxCop is currently not supported on mono"
"Exception message should be as expected") ]

[<Tests>]
let tests = testList "Fake.DotNet.FxCop.Tests" testCases
let tests = testList "Fake.DotNet.FxCop.Tests" testCases
14 changes: 12 additions & 2 deletions src/test/Fake.Core.UnitTests/Fake.DotNet.ILMerge.fs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,17 @@ let testCases =
libs |> Seq.head
libs |> Seq.last ]
"Strings should be assigned as expected" ]
else []
else
[ testCase "Test failure on non-Windows platforms" <| fun _ ->
let p = ILMerge.Params.Create()
let dummy = Guid.NewGuid().ToString()
let dummy2 = Guid.NewGuid().ToString()
Expect.throwsC (fun () -> ILMerge.run p dummy dummy2)
(fun ex ->
Expect.equal (ex.GetType()) typeof<NotSupportedException>
"Exception type should be as expected"
Expect.equal ex.Message "ILMerge is currently not supported on mono"
"Exception message should be as expected") ]

[<Tests>]
let tests = testList "Fake.DotNet.ILMerge.Tests" testCases
let tests = testList "Fake.DotNet.ILMerge.Tests" testCases

0 comments on commit ecdf0bf

Please sign in to comment.