|
| 1 | +Test that `enabled_if` fields work as expected for executables with read pform. |
| 2 | + |
| 3 | +Check that enabled_if doesn't work before dune lang 2.3 |
| 4 | + |
| 5 | + $ make_dune_project 2.0 |
| 6 | + $ dune exec ./main.exe |
| 7 | + File "dune", line 5, characters 1-59: |
| 8 | + 5 | (enabled_if (= %{read:./config/enable_executable} "true"))) |
| 9 | + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 10 | + Error: 'enabled_if' is only available since version 2.3 of the dune language. |
| 11 | + Please update your dune-project file to have (lang dune 2.3). |
| 12 | + [1] |
| 13 | + |
| 14 | +Check that only common vars are allowed in enabled_if within the executable |
| 15 | +stanza in older dune lang versions: |
| 16 | + |
| 17 | + $ make_dune_project 3.0 |
| 18 | + $ dune exec ./main.exe |
| 19 | + File "dune", line 5, characters 16-50: |
| 20 | + 5 | (enabled_if (= %{read:./config/enable_executable} "true"))) |
| 21 | + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 22 | + Error: Only architecture, system, model, os_type, ccomp_type, profile, |
| 23 | + ocaml_version, context_name, arch_sixtyfour and env variables are allowed in |
| 24 | + this 'enabled_if' field. Please upgrade your dune language to at least 3.15. |
| 25 | + [1] |
| 26 | + |
| 27 | +Check that the executable is correctly enabled: |
| 28 | + |
| 29 | + $ make_dune_project 3.24 |
| 30 | + $ dune exec ./main.exe |
| 31 | + File "dune", line 5, characters 16-50: |
| 32 | + 5 | (enabled_if (= %{read:./config/enable_executable} "true"))) |
| 33 | + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 34 | + Error: Only architecture, system, model, os_type, ccomp_type, profile, |
| 35 | + ocaml_version, context_name, arch_sixtyfour and env variables are allowed in |
| 36 | + this 'enabled_if' field. Please upgrade your dune language to at least 3.15. |
| 37 | + [1] |
| 38 | + |
| 39 | +Check that the executable is correctly disabled: |
| 40 | + |
| 41 | + $ dune exec ./disabled.exe |
| 42 | + File "dune", line 5, characters 16-50: |
| 43 | + 5 | (enabled_if (= %{read:./config/enable_executable} "true"))) |
| 44 | + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 45 | + Error: Only architecture, system, model, os_type, ccomp_type, profile, |
| 46 | + ocaml_version, context_name, arch_sixtyfour and env variables are allowed in |
| 47 | + this 'enabled_if' field. Please upgrade your dune language to at least 3.15. |
| 48 | + [1] |
0 commit comments