-
Notifications
You must be signed in to change notification settings - Fork 415
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Stephen Sherratt <[email protected]>
- Loading branch information
Showing
6 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
test/blackbox-tests/test-cases/preprocessor-directory.t/dune-project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
(lang dune 3.7) | ||
(package (name foo)) |
2 changes: 2 additions & 0 deletions
2
test/blackbox-tests/test-cases/preprocessor-directory.t/rewrite.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/sh | ||
printf 'let () = print_endline "foo (from the rewrite.sh script in the project root directory)"' |
23 changes: 23 additions & 0 deletions
23
test/blackbox-tests/test-cases/preprocessor-directory.t/run.t
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
This test exercises the logic for choosing the directory from which to invoke | ||
the preprocessor command. There are two rewrite.sh scripts in this test: one in | ||
the root directory which rewrites the source to print "foo ..." and one in the | ||
src directory which writes the source to print "bar ...". | ||
|
||
Initially the project uses dune lang 3.7 so the preprocessor command is invoked | ||
from the project root: | ||
$ cat dune-project | ||
(lang dune 3.7) | ||
(package (name foo)) | ||
$ dune exec ./src/foo.exe | ||
foo (from the rewrite.sh script in the project root directory) | ||
|
||
Change the versiono of the dune language to 3.8: | ||
$ sed -i.bak 's/(lang dune 3.7)/(lang dune 3.8)/' dune-project | ||
|
||
Now the preprocessor should be invoked from the src directory because the dune | ||
file which specifies the preprocessor is located there: | ||
$ cat dune-project | ||
(lang dune 3.8) | ||
(package (name foo)) | ||
$ dune exec ./src/foo.exe | ||
bar (from the rewrite.sh script in the src directory) |
11 changes: 11 additions & 0 deletions
11
test/blackbox-tests/test-cases/preprocessor-directory.t/src/dune
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
; An executable which invokes a rewriter to exercise the logic for choosing the | ||
; directory in which to invoke the rewriter. This project has two files named | ||
; "rewrite.sh". One next to this dune file, and one in the project root. This | ||
; project is designed to work in both the case where the rewriter is invoked | ||
; from the project root (the behaviour in dune <= 3.7) and from the directory | ||
; containing the dune file that specifies the preprocessing logic. | ||
(executable | ||
(public_name foo) | ||
(preprocessor_deps rewrite.sh ../rewrite.sh) | ||
(preprocess | ||
(pps ppx_inline_test -- -pp ./rewrite.sh))) |
1 change: 1 addition & 0 deletions
1
test/blackbox-tests/test-cases/preprocessor-directory.t/src/foo.ml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
let () = () |
2 changes: 2 additions & 0 deletions
2
test/blackbox-tests/test-cases/preprocessor-directory.t/src/rewrite.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/sh | ||
printf 'let () = print_endline "bar (from the rewrite.sh script in the src directory)"' |