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: enabled_if with
env
variable (ocaml#10936)
* fix: enabled_if with `env` variable Signed-off-by: Alpha DIALLO <moyodiallo@gmail.com>
- Loading branch information
1 parent
d170703
commit aeed649
Showing
5 changed files
with
78 additions
and
23 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- Fix `enabled_if` when it uses `env` variable. (#10936, fixes #10905, @moyodiallo) |
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,52 @@ | ||
Test enabled_if with 'env' variable. | ||
|
||
$ cat > dune-project <<EOF | ||
> (lang dune 3.14) | ||
> (name dune-test) | ||
> (package | ||
> (name dune-test)) | ||
> EOF | ||
|
||
$ cat > dune <<EOF | ||
> (executable | ||
> (name main) | ||
> (public_name dune_test) | ||
> (modules main) | ||
> (package dune-test) | ||
> (modes exe)) | ||
> (executable | ||
> (name main_2) | ||
> (public_name dune_test_2) | ||
> (enabled_if (= enabled %{env:MYVAR=disabled})) | ||
> (modules main_2) | ||
> (package dune-test) | ||
> (modes exe)) | ||
> EOF | ||
|
||
$ MYVAR=disabled dune exec -- dune_test | ||
File "dune", line 10, characters 24-45: | ||
10 | (enabled_if (= enabled %{env:MYVAR=disabled})) | ||
^^^^^^^^^^^^^^^^^^^^^ | ||
Error: %{env:..} is only available since version 3.15 of the dune language. | ||
Please update your dune-project file to have (lang dune 3.15). | ||
[1] | ||
|
||
$ cat > dune-project <<EOF | ||
> (lang dune 3.15) | ||
> (name dune-test) | ||
> (package | ||
> (name dune-test)) | ||
> EOF | ||
|
||
$ cat > main.ml <<EOF | ||
> let () = print_string "Hello world" | ||
> EOF | ||
|
||
$ MYVAR=disabled dune exec -- dune_test | ||
Hello world | ||
$ MYVAR=enabled dune exec -- dune_test | ||
File "dune", line 11, characters 10-16: | ||
11 | (modules main_2) | ||
^^^^^^ | ||
Error: Module Main_2 doesn't exist. | ||
[1] |
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