Debian Codegraph @

test/blackbox-tests/test-cases/pkg/ocamllsp/dev-tool-ocamllsp-configure.t

raw
1 Test that adding constraints to ocamllsp via `lock_dir` works.
2
3 $ mkrepo
4 $ mk_ocaml 5.2.0
5 $ mkpkg ocaml-lsp-server <<EOF
6 > depends: ["ocamlbuild"]
7 > install: [
8 > [ "sh" "-c" "echo '#!/bin/sh' > %{bin}%/ocamllsp" ]
9 > [ "sh" "-c" "echo 'echo hello from fake ocamllsp' >> %{bin}%/ocamllsp" ]
10 > [ "chmod" "a+x" "%{bin}%/ocamllsp" ]
11 > ]
12 > EOF
13
14 $ mkpkg ocamlbuild 0.0.1
15 $ mkpkg ocamlbuild 0.0.2
16 $ mkpkg ocamlbuild 0.0.3
17
18 $ cat > dune-project <<EOF
19 > (lang dune 3.21)
20 >
21 > (package
22 > (name foo)
23 > (allow_empty)
24 > (depends
25 > (ocaml (= 5.2.0))))
26 > EOF
27
28 Add ocamlbuild 0.0.2 as a constraint to make sure the constraint field makes the solver pick the correct version
29
30 $ cat > dune-workspace << EOF
31 > (lang dune 3.20)
32 > (pkg enabled)
33 > (lock_dir
34 > (path "${dev_tool_lock_dir}")
35 > (constraints
36 > (ocamlbuild (= 0.0.2)))
37 > (repositories mock))
38 > (lock_dir
39 > (repositories mock))
40 > (repository
41 > (name mock)
42 > (url "file://$(pwd)/mock-opam-repository"))
43 > EOF
44
45 Installing ocamllsp picks the right version of ocamlbuild
46
47 $ dune tools install ocamllsp
48 Solution for _build/.dev-tools.locks/ocaml-lsp-server:
49 - ocaml-base-compiler.5.2.0
50 - ocaml-compiler.5.2.0
51 - ocaml-lsp-server.0.0.1
52 - ocamlbuild.0.0.2