Add a test case for project_root

Signed-off-by: Etienne Millon <etienne@cryptosense.com>
This commit is contained in:
Etienne Millon 2018-07-05 16:32:26 +02:00 committed by Rudi Grinberg
parent ca342fd840
commit 2c29217a20
8 changed files with 42 additions and 0 deletions

View File

@ -507,6 +507,14 @@
test-cases/private-public-overlap
(progn (run %{exe:cram.exe} -test run.t) (diff? run.t run.t.corrected)))))
(alias
(name project-root)
(deps (package dune) (source_tree test-cases/project-root))
(action
(chdir
test-cases/project-root
(progn (run %{exe:cram.exe} -test run.t) (diff? run.t run.t.corrected)))))
(alias
(name promote)
(deps (package dune) (source_tree test-cases/promote))
@ -673,6 +681,7 @@
(alias path-variables)
(alias ppx-rewriter)
(alias private-public-overlap)
(alias project-root)
(alias promote)
(alias quoting)
(alias redirections)
@ -740,6 +749,7 @@
(alias output-obj)
(alias package-dep)
(alias path-variables)
(alias project-root)
(alias promote)
(alias quoting)
(alias redirections)

View File

@ -0,0 +1,4 @@
(alias
(name runtest)
(action (echo "From root: %{project_root}\n"))
)

View File

@ -0,0 +1,4 @@
(alias
(name runtest)
(action (echo "From dune-file/a/b/: %{project_root}\n"))
)

View File

@ -0,0 +1,4 @@
(alias
(name runtest)
(action (echo "From dune-file/a/: %{project_root}\n"))
)

View File

@ -0,0 +1 @@
(lang dune 1.0)

View File

@ -0,0 +1,5 @@
(alias
((name runtest)
(action (echo "From jbuild/a/b/: ${SCOPE_ROOT}\n"))
)
)

View File

@ -0,0 +1,5 @@
(alias
((name runtest)
(action (echo "From jbuild/a/: ${SCOPE_ROOT}\n"))
)
)

View File

@ -0,0 +1,9 @@
%{SCOPE_ROOT} (or ${SCOPE_ROOT} in jbuild files) refers to the root of the
project.
$ dune runtest
From dune-file/a/b/: ../../..
From dune-file/a/: ../..
From jbuild/a/b/: ../../..
From jbuild/a/: ../..
From root: .