This commit is contained in:
swrup 2025-11-11 02:07:51 +01:00
parent aa2ff7b2f0
commit 2f3113f55d
11742 changed files with 1223940 additions and 0 deletions

View file

@ -0,0 +1,3 @@
(rule
(targets x y)
(action (with-stdout-to %{targets} (echo foo))))

View file

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

View file

@ -0,0 +1,10 @@
This behavior is surprising, we should get an error about the fact
that ${@} is not quoted and doesn't contain exactly 1 element
$ dune build x
File "dune", line 3, characters 25-35:
3 | (action (with-stdout-to %{targets} (echo foo))))
^^^^^^^^^^
Error: Variable %{targets} expands to 2 values, however a single value is
expected here. Please quote this atom.
[1]

View file

@ -0,0 +1,34 @@
$ cat > a
$ cat > b
$ cat > dune-project << EOF
> (lang dune 3.9)
> EOF
It should be possible to expand %{deps} in a cat action since it allows multiple
arguments.
$ cat > dune <<EOF
> (rule
> (alias foo)
> (deps a b)
> (action
> (cat %{deps})))
> EOF
This isn't possible in 3.9.
$ dune build @foo
File "dune", line 5, characters 7-14:
5 | (cat %{deps})))
^^^^^^^
Error: Variable %{deps} expands to 2 values, however a single value is
expected here. Please quote this atom.
[1]
But it is in 3.10:
$ cat > dune-project << EOF
> (lang dune 3.10)
> EOF
$ dune build @foo

View file

@ -0,0 +1,8 @@
(alias
(name unquoted)
(action (echo %{read:foo bar.txt})))
(alias
(name quoted)
(action (echo "%{read:foo bar.txt}")))

View file

@ -0,0 +1 @@
filename contains spaces

View file

@ -0,0 +1,6 @@
$ dune build @quoted
File "dune", line 4, characters 25-26:
4 | (action (echo %{read:foo bar.txt})))
^
Error: The character ' ' is not allowed inside %{...} forms
[1]

View file

@ -0,0 +1,3 @@
(rule
(targets s t)
(action (with-stdout-to "%{targets}" (echo foo))))

View file

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

View file

@ -0,0 +1,11 @@
The targets should only be interpreted as a single path when quoted
$ dune build s
File "dune", lines 1-3, characters 0-72:
1 | (rule
2 | (targets s t)
3 | (action (with-stdout-to "%{targets}" (echo foo))))
Error: Rule failed to generate the following targets:
- s
- t
[1]

View file

@ -0,0 +1,3 @@
let () =
Printf.printf "Number of args: %d\n" (Array.length Sys.argv - 1)

View file

@ -0,0 +1,6 @@
(executable
(name count_args))
(alias
(name runtest)
(action (run ./count_args.exe %{read-lines:args})))

View file

@ -0,0 +1,2 @@
$ dune runtest
Number of args: 3

View file

@ -0,0 +1,4 @@
(alias
(name runtest)
(action (echo "lines: %{read-lines:foo}")))

View file

@ -0,0 +1,2 @@
$ dune runtest
lines: foo bar baz