Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run fsharp test on Mac from terminal?

Tags:

macos

mono

f#

nunit

I want to learn fsharp. So I'm looking at exercism.io

In their readme they instruct to use Xamarin Studio for running the test http://exercism.io/languages/fsharp/tests

But I would like to just run the tests from the terminal. The exercises from exercism only include one F# file e.g. HelloWorldTest.fs.

This answer Running tests on Mac OS X console using mono/nunit-console/4 instructs to run nunit-console with a .csproj or .dll file. But these files are not present in the exercism files. So I'm not clear what to do.

I have install mono using homebrew. How do I run the NUnit test from the terminal in OSX?

like image 790
Sebastian Avatar asked Oct 05 '16 07:10

Sebastian


People also ask

How to run f# from command line?

To run F# Interactive from the console, run dotnet fsi . You will find dotnet fsi in any . NET SDK. For information about available command-line options, see F# Interactive Options.

Does F# work on Mac?

F# is supported in the Visual Studio for Mac IDE. Ensure that you have Visual Studio for Mac installed.


1 Answers

You may have to use xbuild on the command line to compile the fsproj file then the resulting dll can be executed with nunit on the commandline also.

If you don't have the fsproj you can use fsharpc on the file directly then call nunit, remembering to use mono to execute nunit.

fsharpc HelloWorldTest.fs

mono nunit-console.exe HelloWorldTest.exe

Sorry am not in a position to test this, but should be something like this.

like image 195
Mr. Mr. Avatar answered Sep 23 '22 13:09

Mr. Mr.