From 2014e73ee843a12b5dd14b0c943bed3984fa85af Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Tue, 15 Oct 2019 22:31:05 +0900 Subject: [PATCH] Add some failing tests to the alias field Signed-off-by: Rudi Grinberg --- test/blackbox-tests/dune.inc | 10 +++++ .../test-cases/github2681/run.t | 37 +++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 test/blackbox-tests/test-cases/github2681/run.t diff --git a/test/blackbox-tests/dune.inc b/test/blackbox-tests/dune.inc index bae29e164104..61c26edf8d31 100644 --- a/test/blackbox-tests/dune.inc +++ b/test/blackbox-tests/dune.inc @@ -853,6 +853,14 @@ test-cases/github2629 (progn (run %{exe:cram.exe} -test run.t) (diff? run.t run.t.corrected))))) +(alias + (name github2681) + (deps (package dune) (source_tree test-cases/github2681)) + (action + (chdir + test-cases/github2681 + (progn (run %{exe:cram.exe} -test run.t) (diff? run.t run.t.corrected))))) + (alias (name github534) (deps (package dune) (source_tree test-cases/github534)) @@ -1950,6 +1958,7 @@ (alias github25) (alias github2584) (alias github2629) + (alias github2681) (alias github534) (alias github568) (alias github597) @@ -2166,6 +2175,7 @@ (alias github25) (alias github2584) (alias github2629) + (alias github2681) (alias github534) (alias github568) (alias github597) diff --git a/test/blackbox-tests/test-cases/github2681/run.t b/test/blackbox-tests/test-cases/github2681/run.t new file mode 100644 index 000000000000..dba9c412a884 --- /dev/null +++ b/test/blackbox-tests/test-cases/github2681/run.t @@ -0,0 +1,37 @@ +A rule may have an alias field. This denotes that the action of the rule is a +dependency of the alias. + $ mkdir simple && cd simple + $ cat > dune-project < (lang dune 2.0) + > EOF + $ cat > dune < (rule + > (action (with-stdout-to foo (echo "hello world"))) + > (alias bar)) + > EOF + $ dune build @bar --display short + File "dune", line 2, characters 9-50: + 2 | (action (with-stdout-to foo (echo "hello world"))) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + Error: Rule has targets in different directories. + Targets: + - _build/.aliases/default/bar-fc3cef760337ee5dd7a56722c8e58053 + - _build/default/foo + [1] + +The field order should not affect the alias field: + $ cd .. && mkdir field-order && cd field-order + $ cat > dune-project < (lang dune 2.0) + > EOF + $ cat > dune < (rule + > (alias bar) + > (action (with-stdout-to foo (echo "hello world")))) + > EOF + $ dune build + File "dune", line 2, characters 2-7: + 2 | (alias bar) + ^^^^^ + Error: Unknown action or rule field. + [1]