forked from ocaml/dune
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(mdx): record runtime dependency to prelude
When mdx is used in program-generation mode (version >= 0.2), the paths used as preludes are recorded in the executable, but the contents of files are only read when the program is executed. This adds the missing dependencies. Fixes ocaml#7077 Signed-off-by: Etienne Millon <[email protected]>
- Loading branch information
Showing
3 changed files
with
60 additions
and
4 deletions.
There are no files selected for viewing
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
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
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,39 @@ | ||
When mdx is used to generate a program, the program will read the preludes at | ||
run time. This test makes sure that this is recorded as a dependency. | ||
|
||
$ cat > dune << EOF | ||
> (mdx (preludes prelude.ml)) | ||
> EOF | ||
|
||
$ cat > dune-project << EOF | ||
> (lang dune 3.6) | ||
> (using mdx 0.3) | ||
> EOF | ||
|
||
$ cat > prelude.ml << EOF | ||
> let foo () = 1 | ||
> EOF | ||
|
||
$ cat > README.md << 'EOF' | ||
> ```ocaml | ||
> # foo ();; | ||
> - : int = 1 | ||
> ``` | ||
> EOF | ||
|
||
$ dune runtest | ||
|
||
$ echo 'let foo () = 2' > prelude.ml | ||
|
||
$ dune runtest --auto-promote | ||
File "README.md", line 1, characters 0-0: | ||
Error: Files _build/default/README.md and | ||
_build/default/.mdx/README.md.corrected differ. | ||
Promoting _build/default/.mdx/README.md.corrected to README.md. | ||
[1] | ||
|
||
$ cat README.md | ||
```ocaml | ||
# foo ();; | ||
- : int = 2 | ||
``` |