Skip to content

Commit

Permalink
scripts/runTests.fsx: acceptance test for --help
Browse files Browse the repository at this point in the history
  • Loading branch information
knocte committed Aug 21, 2023
1 parent dd66eb3 commit 8652d3c
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion scripts/runTests.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,33 @@ let UnwrapDefault(proc: ProcessResult) =
proc.UnwrapDefault() |> ignore<string>
#endif

let fsxWorkingCommandInUnixAfterBeingInstalled =
{
Command = "/usr/bin/env"
Arguments = "fsx"
}

let helpCommand =
let helpFlag = "--help"

match Misc.GuessPlatform() with
| Misc.Platform.Windows ->
{
Command = GetFsxWindowsLauncher().FullName
Arguments = helpFlag
}
| _ ->
{
Command = fsxWorkingCommandInUnixAfterBeingInstalled.Command
Arguments =
sprintf
"%s %s"
fsxWorkingCommandInUnixAfterBeingInstalled.Arguments
helpFlag
}

Process.Execute(helpCommand, Echo.All) |> UnwrapDefault

let basicTest = Path.Combine(TestDir.FullName, "test.fsx") |> FileInfo

Process.Execute(CreateCommand(basicTest, String.Empty), Echo.All)
Expand Down Expand Up @@ -334,14 +361,17 @@ Process.Execute(CreateCommand(legacyDefineTest, String.Empty), Echo.All)


let contentOfScriptWithWarning =
"""#!/usr/bin/env fsx
sprintf
"""#!%s %s
let GiveMeBool() : bool =
false
GiveMeBool()
printf "hello"
"""
fsxWorkingCommandInUnixAfterBeingInstalled.Command
fsxWorkingCommandInUnixAfterBeingInstalled.Arguments

let warningTest = Path.Combine(TestDir.FullName, "testWarning.fsx") |> FileInfo
File.WriteAllText(warningTest.FullName, contentOfScriptWithWarning)
Expand Down

0 comments on commit 8652d3c

Please sign in to comment.