FSharp.Formatting
FSharp.Formatting copied to clipboard
Using testcontainers in a fsx script gives wrong output
Putting this fsx in the docs directory:
> (**
# Usage
*)
(*** hide ***)
#r "nuget: Testcontainers.PostgreSql, 3.6.0"
open Testcontainers.PostgreSql
task {
(** # Start container *)
let container =
(new PostgreSqlBuilder())
.WithImage("postgres:16")
.Build();
do! container.StartAsync()
printfn "%s" (container.GetConnectionString())
(** But let's not forget to stop it with *)
do! container.DisposeAsync().AsTask()
(*** hide ***)
}
|> Async.AwaitTask |> Async.RunSynchronously
and then running fsdocs build
gives a page with content about test containers:
It can be reproduced on linux with these commands:
:/tmp$ dotnet new console --language "F#" -n fsdocdemo
:/tmp$ cd fsdocdemo/
:/tmp/fsdocdemo$ mkdir docs
:/tmp/fsdocdemo$ cat >docs/minimal.fsx <<EOF
> (**
# Usage
*)
(*** hide ***)
#r "nuget: Testcontainers.PostgreSql, 3.6.0"
open Testcontainers.PostgreSql
task {
(** # Start container *)
let container =
(new PostgreSqlBuilder())
.WithImage("postgres:16")
.Build();
do! container.StartAsync()
printfn "%s" (container.GetConnectionString())
(** But let's not forget to stop it with *)
do! container.DisposeAsync().AsTask()
(*** hide ***)
}
|> Async.AwaitTask |> Async.RunSynchronously
EOF
:/tmp/fsdocdemo$ fsdocs build
:/tmp/fsdocdemo$ cd output
:/tmp/fsdocdemo$ python -m http.server
and access http://localhost:8000/minimal.html
Some more information:
$ dotnet --version
6.0.418
$ fsdocs --version
fsdocs 19.1.1
$ uname -r
6.2.0-37-generic