From 2c50adef12fbf2e56c2a367d1d1a5a70a85e1637 Mon Sep 17 00:00:00 2001 From: Martin521 <29605222+Martin521@users.noreply.github.com> Date: Sun, 22 Feb 2026 15:50:59 +0100 Subject: [PATCH 1/4] added examples; moved to xunit.v3 --- .vscode/launch.json | 4 ++-- docs/examples/testing/README.md | 10 ++++++++++ docs/examples/testing/explore.fs | 5 +++++ docs/examples/testing/mylib/Directory.Build.props | 5 +++++ docs/examples/testing/mylib/Library.fs | 3 +++ docs/examples/testing/mylib/mylib.fsproj | 11 +++++++++++ docs/examples/testing/tests.fs | 13 +++++++++++++ tests/Runfs.Tests/Runfs.Tests.fsproj | 13 ++----------- 8 files changed, 51 insertions(+), 13 deletions(-) create mode 100644 docs/examples/testing/README.md create mode 100644 docs/examples/testing/explore.fs create mode 100644 docs/examples/testing/mylib/Directory.Build.props create mode 100644 docs/examples/testing/mylib/Library.fs create mode 100644 docs/examples/testing/mylib/mylib.fsproj create mode 100644 docs/examples/testing/tests.fs diff --git a/.vscode/launch.json b/.vscode/launch.json index eda6d16..6f55b45 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -9,8 +9,8 @@ "type": "coreclr", "request": "launch", "program": "${workspaceFolder}/artifacts/bin/Runfs/debug/Runfs.dll", - "args": ["--verbose", "tests/Runfs.Tests/TestFiles/test1.fs", "arg1", "arg2"], - "cwd": "${workspaceFolder}", + "args": ["--verbose", "DirectivesTests.fs"], + "cwd": "${workspaceFolder}/tests/FileBased/", "stopAtEntry": false, "console": "internalConsole", "preLaunchTask": "Build: Runfs.fsproj" diff --git a/docs/examples/testing/README.md b/docs/examples/testing/README.md new file mode 100644 index 0000000..372166b --- /dev/null +++ b/docs/examples/testing/README.md @@ -0,0 +1,10 @@ +# Using runfs for library testing + +## Explorative testing + +Just create an ad-hoc driver file (see example file `explore.fs`), add a project reference and start testing your library API by running `dotnet runfs explore.fs`. + +## Unit test development / fixes + +Rather than building a test project, discovering the tests, selecting the one you are interested in and running it, you just add the project reference and the test framework package reference to the test file you are interested in (see example file `tests.fs`, using xunit.v3) and run it with runfs (here: `dotnet runfs tests.fs`). + diff --git a/docs/examples/testing/explore.fs b/docs/examples/testing/explore.fs new file mode 100644 index 0000000..0dbfb47 --- /dev/null +++ b/docs/examples/testing/explore.fs @@ -0,0 +1,5 @@ +#r_project "D:/fsharp/projects/div/Runfs/docs/examples/testing/mylib/mylib.fsproj" + +open Mylib + +printfn $"Hello {x}" diff --git a/docs/examples/testing/mylib/Directory.Build.props b/docs/examples/testing/mylib/Directory.Build.props new file mode 100644 index 0000000..c339825 --- /dev/null +++ b/docs/examples/testing/mylib/Directory.Build.props @@ -0,0 +1,5 @@ + + + true + + diff --git a/docs/examples/testing/mylib/Library.fs b/docs/examples/testing/mylib/Library.fs new file mode 100644 index 0000000..4b5de8c --- /dev/null +++ b/docs/examples/testing/mylib/Library.fs @@ -0,0 +1,3 @@ +module Mylib + +let x = 42 diff --git a/docs/examples/testing/mylib/mylib.fsproj b/docs/examples/testing/mylib/mylib.fsproj new file mode 100644 index 0000000..b35881d --- /dev/null +++ b/docs/examples/testing/mylib/mylib.fsproj @@ -0,0 +1,11 @@ + + + + net10.0 + + + + + + + diff --git a/docs/examples/testing/tests.fs b/docs/examples/testing/tests.fs new file mode 100644 index 0000000..f351690 --- /dev/null +++ b/docs/examples/testing/tests.fs @@ -0,0 +1,13 @@ +module Mylib.Tests + +#r_package "xunit.v3.mtp-v2@3.2.2" +#r_project "mylib/mylib.fsproj" + +#nowarn 988 + +open Xunit +open Mylib + +[] +let test1 () = + Assert.Equal(x, 42) diff --git a/tests/Runfs.Tests/Runfs.Tests.fsproj b/tests/Runfs.Tests/Runfs.Tests.fsproj index 2263448..ef64dd3 100644 --- a/tests/Runfs.Tests/Runfs.Tests.fsproj +++ b/tests/Runfs.Tests/Runfs.Tests.fsproj @@ -1,23 +1,14 @@ net10.0 + Exe - - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - + From 09f9ff9111f2a3d12add3fc226e3a3b067478a20 Mon Sep 17 00:00:00 2001 From: Martin521 <29605222+Martin521@users.noreply.github.com> Date: Sun, 22 Feb 2026 15:55:06 +0100 Subject: [PATCH 2/4] changelog update --- CHANGELOG.md | 10 ++++++++++ src/Runfs/Runfs.fsproj | 11 +++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0acc9bc..6cdbcaa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # CHANGELOG +## 1.0.10 + +### added + +* documentation examples + +### changed + +* moved to xunit.v3 + ## 1.0.9 * changed global and target framework to net10 diff --git a/src/Runfs/Runfs.fsproj b/src/Runfs/Runfs.fsproj index a82ee05..e11908f 100644 --- a/src/Runfs/Runfs.fsproj +++ b/src/Runfs/Runfs.fsproj @@ -2,7 +2,7 @@ Runfs - 1.0.9 + 1.0.10 "dotnet run app.cs" functionality for F#. Copyright 2025 by Martin521 Martin521 and contributors @@ -15,12 +15,15 @@ True runfs -## 1.0.9 +## 1.0.10 + +### added + +* documentation examples ### changed -* changed global and target framework to net10 -* updated README +* moved to xunit.v3 true From fa9d9f5cf7804dfe60bc5726edde8f5f5ee51770 Mon Sep 17 00:00:00 2001 From: Martin521 <29605222+Martin521@users.noreply.github.com> Date: Sun, 22 Feb 2026 16:01:26 +0100 Subject: [PATCH 3/4] added README link --- .vscode/launch.json | 4 ++-- README.md | 2 +- docs/examples/testing/README.md | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 6f55b45..eda6d16 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -9,8 +9,8 @@ "type": "coreclr", "request": "launch", "program": "${workspaceFolder}/artifacts/bin/Runfs/debug/Runfs.dll", - "args": ["--verbose", "DirectivesTests.fs"], - "cwd": "${workspaceFolder}/tests/FileBased/", + "args": ["--verbose", "tests/Runfs.Tests/TestFiles/test1.fs", "arg1", "arg2"], + "cwd": "${workspaceFolder}", "stopAtEntry": false, "console": "internalConsole", "preLaunchTask": "Build: Runfs.fsproj" diff --git a/README.md b/README.md index 23ae9a2..d9eebb9 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ The source file can contain directives to reference libraries and to influence t Because of a) concerns of parts of the F# community about having two similar tools (`dotnet fsi script.fsx` and `dotnet runfs app.fs`) and b) missing "market pull", I have currently no further plans for this project. -The tool is still available as dotnet tool and can be useful especially for ad-hoc testing of library projects. +The tool is still available as dotnet tool and can be useful especially for [ad-hoc testing of library projects](docs/examples/testing/README.md). ## Usage diff --git a/docs/examples/testing/README.md b/docs/examples/testing/README.md index 372166b..246433d 100644 --- a/docs/examples/testing/README.md +++ b/docs/examples/testing/README.md @@ -2,7 +2,7 @@ ## Explorative testing -Just create an ad-hoc driver file (see example file `explore.fs`), add a project reference and start testing your library API by running `dotnet runfs explore.fs`. +Just create an ad-hoc driver file (see example file `explore.fs` in this directory), add a project reference and start testing your library API by running `dotnet runfs explore.fs`. ## Unit test development / fixes From 346b30085b753628c31fc0cef96ec1bd20517a9e Mon Sep 17 00:00:00 2001 From: Martin521 <29605222+Martin521@users.noreply.github.com> Date: Sun, 22 Feb 2026 16:10:41 +0100 Subject: [PATCH 4/4] added MTP entry to global.json --- global.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/global.json b/global.json index 69e101b..7cceb99 100644 --- a/global.json +++ b/global.json @@ -3,5 +3,8 @@ "version": "10.0.100", "rollForward": "latestMinor", "allowPrerelease": false + }, + "test": { + "runner": "Microsoft.Testing.Platform" } -} \ No newline at end of file +}