| 1 |
Test that the ocamllsp dev tool can see the ocamlformat dev tool. |
| 2 |
|
| 3 |
$ mkrepo |
| 4 |
$ mkpkg ocaml 5.2.0 |
| 5 |
|
| 6 |
$ cat > dune-workspace <<EOF |
| 7 |
> (lang dune 3.20) |
| 8 |
> (pkg enabled) |
| 9 |
> (lock_dir |
| 10 |
> (path "dev-tools.locks/ocaml-lsp-server") |
| 11 |
> (repositories mock)) |
| 12 |
> (lock_dir |
| 13 |
> (path "dev-tools.locks/ocamlformat") |
| 14 |
> (repositories mock)) |
| 15 |
> (lock_dir |
| 16 |
> (repositories mock)) |
| 17 |
> EOF |
| 18 |
$ add_mock_repo_if_needed |
| 19 |
|
| 20 |
Make a fake ocamllsp package that prints out the PATH variable: |
| 21 |
$ mkpkg ocaml-lsp-server <<EOF |
| 22 |
> install: [ |
| 23 |
> [ "sh" "-c" "echo '#!/bin/sh' > %{bin}%/ocamllsp" ] |
| 24 |
> [ "sh" "-c" "echo 'echo fake ocamllsp will now run fake ocamlformat:' >> %{bin}%/ocamllsp" ] |
| 25 |
> [ "sh" "-c" "echo 'ocamlformat' >> %{bin}%/ocamllsp" ] |
| 26 |
> [ "sh" "-c" "chmod a+x %{bin}%/ocamllsp" ] |
| 27 |
> ] |
| 28 |
> EOF |
| 29 |
|
| 30 |
Make a fake ocamlformat |
| 31 |
$ mkpkg ocamlformat <<EOF |
| 32 |
> install: [ |
| 33 |
> [ "sh" "-c" "echo '#!/bin/sh' > %{bin}%/ocamlformat" ] |
| 34 |
> [ "sh" "-c" "echo 'echo hello from fake ocamlformat' >> %{bin}%/ocamlformat" ] |
| 35 |
> [ "sh" "-c" "chmod a+x %{bin}%/ocamlformat" ] |
| 36 |
> ] |
| 37 |
> EOF |
| 38 |
|
| 39 |
$ make_lockdir |
| 40 |
$ make_lockpkg ocaml <<EOF |
| 41 |
> (version 5.2.0) |
| 42 |
> EOF |
| 43 |
|
| 44 |
$ dune tools install ocamlformat |
| 45 |
Solution for dev-tools.locks/ocamlformat: |
| 46 |
- ocamlformat.0.0.1 |
| 47 |
|
| 48 |
$ dune tools exec ocamllsp |
| 49 |
Solution for dev-tools.locks/ocaml-lsp-server: |
| 50 |
- ocaml.5.2.0 |
| 51 |
- ocaml-lsp-server.0.0.1 |
| 52 |
Running 'ocamllsp' |
| 53 |
fake ocamllsp will now run fake ocamlformat: |
| 54 |
hello from fake ocamlformat |