Skip to content

Commit

Permalink
scripts/runTests.fsx: acceptance test for warning
Browse files Browse the repository at this point in the history
  • Loading branch information
knocte committed Aug 18, 2023
1 parent e293f1e commit 02c784e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
24 changes: 24 additions & 0 deletions scripts/runTests.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -331,3 +331,27 @@ let legacyDefineTest =

Process.Execute(CreateCommand(legacyDefineTest, String.Empty), Echo.All)
|> UnwrapDefault


let warningTest = Path.Combine(TestDir.FullName, "testWarning.fsx") |> FileInfo

let currentDir = Directory.GetCurrentDirectory()

let possibleDirBuildProps =
Path.Combine(currentDir, "Directory.Build.props") |> FileInfo

if possibleDirBuildProps.Exists then
// this file could alter the behaviour of fsxc when compiling, making the result of the test be misleading
possibleDirBuildProps.Delete()

let warningAsErrorProc =
Process.Execute(CreateCommand(warningTest, String.Empty), Echo.All)

match warningAsErrorProc.Result with
| Error _ ->
// warning as error worked!
()
| _ ->
failwithf
"Should have failed to compile/execute %s because warnings as errors"
warningTest.Name
7 changes: 7 additions & 0 deletions test/testWarning.fsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env fsx

let GiveMeBool() : bool =
false

GiveMeBool()
printf "hello"

0 comments on commit 02c784e

Please sign in to comment.