Skip to content

Commit

Permalink
Add a test case
Browse files Browse the repository at this point in the history
Signed-off-by: Alpha DIALLO <[email protected]>
  • Loading branch information
moyodiallo committed Nov 7, 2024
1 parent 64bcacf commit f515fa8
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/blackbox-tests/test-cases/pkg/helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,15 @@ print_source() {
solve() {
make_project $@ | solve_project
}

make_mock_tool_package() {
package=$1
binary=$2
mkpkg $package <<EOF
install: [
[ "sh" "-c" "echo '#!/bin/sh' > %{bin}%/$binary" ]
[ "sh" "-c" "echo 'echo hello from fake $binary' >> %{bin}%/$binary" ]
[ "sh" "-c" "chmod a+x %{bin}%/$binary" ]
]
EOF
}
50 changes: 50 additions & 0 deletions test/blackbox-tests/test-cases/pkg/tools-install.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
$ . ./helpers.sh

$ mkrepo
$ make_mock_tool_package odoc odoc
$ make_mock_tool_package ocaml-lsp-server ocamllsp
$ make_mock_tool_package ocamlformat ocamlformat
$ mkpkg ocaml 5.2.0

$ cat > dune-workspace <<EOF
> (lang dune 3.16)
> (lock_dir
> (path "dev-tools.locks/odoc")
> (repositories mock))
> (lock_dir
> (path "dev-tools.locks/ocamlformat")
> (repositories mock))
> (lock_dir
> (path "dev-tools.locks/ocaml-lsp-server")
> (repositories mock))
> (lock_dir
> (repositories mock))
> (repository
> (name mock)
> (source "file://$(pwd)/mock-opam-repository"))
> EOF

$ cat > dune-project <<EOF
> (lang dune 3.16)
>
> (package
> (name foo)
> (depends ocaml))
> EOF

$ dune pkg lock
Solution for dune.lock:
- ocaml.5.2.0
$ DUNE_CONFIG__LOCK_DEV_TOOL=enabled dune tools install
Solution for dev-tools.locks/ocamlformat:
- ocamlformat.0.0.1
Solution for dev-tools.locks/odoc:
- ocaml.5.2.0
- odoc.0.0.1
Solution for dev-tools.locks/ocaml-lsp-server:
- ocaml.5.2.0
- ocaml-lsp-server.0.0.1
$ ls ./_build/_private/default/.dev-tool
ocaml-lsp-server
ocamlformat
odoc

0 comments on commit f515fa8

Please sign in to comment.